Lab 5: Decisions


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


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.


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


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 file.


Before lab ends, e-mail a copy of 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!