Inlab 5: Decisions

Due: Friday 19 February at 6 pm

Purpose

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

Partners

This is an individual assignment, though collaboration (not solution sharing) is allowed.

Preliminaries

Create a BlueJ project named Inlab5 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

By Friday evening at 6:00 pm, submit the BahnCard.java file into the appropriate D2L dropbox folder. DO NOT SUBMIT .class files. 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.