Lab 5: Decisions

Purpose

The purpose of this in-lab is to introduce you to the concept of making decisions in Java using the if statement.

Partners

You are encouraged to work with one other partner on this assignment. If you work with a partner, you must both be in the same lab section.

Preliminaries

Create a BlueJ project named Lab5 on your lab computer. Place the following files into this project:

Assignment

Train travelers in Germany can buy a one year discount card for the train system called a BahnCard. There are three types of BahnCards: a BahnCard 25 (provides the rider with a 25% discount), a BahnCard 50 (provides the rider with a 50% discount), and a BahnCard 100 (provides the rider with a 100% discount). In Germany, one can travel first class or second class on the train system.

In this assignment, you are going to calculate how much a BahnCard costs to buy, using the following rules.

Note: do not modify the TestProgram.java file.

Submission

Before lab ends, e-mail a copy of BahnCard.java to your lab TA. The subject of the e-mail should be CSCI 111, Lab 5, your lab time, your name, your partner's name. To receive credit, this e-mail must be sent before your lab period finishes. Partial credit can be earned, but late assignments will not be accepted.

Grading - 10 points possible

Helpful Hint

There are three methods in the BahnCard class that you must modify: bahnCard25Price, bahnCard50Price and bahnCard100Price. Do the easiest method first, the second easiest method second and the most difficult method last.

Valid XHTML 1.0!