The class should have accessor methods, getTeam() and getPrice() that get the values of the two instance variables when they are called. It should also have a method named calculateQuantityPrice() that returns an integer giving the total price for a quantity of tickets. This method will take one parameter, an integer representing the number of tickets being purchased. Calculating the total price requires a simple multiplication operation: quantity times price. The multiplication symbol in Java is the asterisk (*).
Define a second class named BuySeasonTicket that contains a main() method that will be used to test the correctness of your implementation of the SeasonTicket class. As in last week's lab, the main() method will use a KeyboardReader object to prompt the user and to read keyboard input from the user.
The main() program should create two SeasonTicket objects, one for the "Yankees", whose season ticket costs $7500, and one for the "Red Sox", whose ticket cost $5000. Take care with the spelling of the team names. It should prompt the user for the team name and for the quantity of tickets they want to purchase. It should then report the total sales price.
Design your algorithm so that it produces exactly output shown here, including all the line breaks and punctuation. This listing shows two separate runs and the user's input is shown in bold face:
This program will help you purchase Yankees or Red Sox season tickets.
What team do you want, Yankees or Red Sox? Yankees
Yankees season tickets cost $7500 per ticket.
How many tickets do you want? 5
That will be a total of $37500
This program will help you purchase Yankees or Red Sox season tickets.
What team do you want, Yankees or Red Sox? Red Sox
Red Sox season tickets cost $5000 per ticket.
How many tickets do you want? 10
That will be a total of $50000
Note that the program must decide based on the user's input whether to quote the price of the Yankees or Red Sox ticket. Note that the program is getting information from the two SeasonTicket objects to report the ticket's price and the total price for the quantity of tickets.
Before handing in your programs, be sure to document your source code.
Have your work checked by the laboratory instructor or TA. Print out and hand in copies of your SeasonTicket.java and BuySeasonTicket.java files.