Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

language : Java Instruction We will write a program that will simulate a Ticketing System for an entertainment venue (e.g. Key Arena, Tacoma Dome, TMobile

language : Java
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Instruction We will write a program that will simulate a Ticketing System for an entertainment venue (e.g. Key Arena, Tacoma Dome, TMobile Park, etc). We will design a Ticket class and a VIPTicket. We will then write a a main client program that will create a set number of Tickets and print out an ASCII art version of the tickets. After we get this working, we will use jUnit tests to test each method in the Ticket and VIPTicket class. Ticket class We will write a Ticket class in the tickets package, where: A ticket has the following instance fields: seat number, cost, and owner. o What access modifier do we typically use The Ticket class should also share a class field with all Ticket objects for the next available seat (this changes every time a ticket is issued). o What java keyword do we use when declaring a class field? A Ticket should be able to be created with no information and also with an owner name and a ticket cost o What type of methods do we need to add to the Ticket Class to create Ticket objects? o Remember, we will assign the seat number using the class field (Tickets should be created starting with seat #1, and every subsequent ticket should be one seat higher.) o Tickets should cost $50 by default. . o What would be a good initial value for the owner field? A Ticket should have accessors for all instance fields: seat number, owner, and cost. o How do you tell the difference between an instance and a class field? o What is another term for accessor methods? A Ticket should have mutators for the owner and the cost. o What is another term for mutator methods? o Why don't we need a mutator for the seat number? A Ticket should have a getType method that returns a String "General Admission" as the ticket type. o Other types of tickets will have different strings to return so you will override this method. o What does override mean in your own words? A Ticket should have an overridden toString method that returns a String that can be used to display a ticket similar to what you see below. We will use the tickets below as a guide. This method could be written in many ways. Let's each try and come up with a solution and share it. Tester Code As we create our Ticket class, we will write tester code in a TicketClient class created in the client package. We will test out our Ticket class from the TicketClient's main method by creating a Ticket object and then calling various methods on it. We will also test out our Ticket class using jUnit tests in our tests directory so we no longer need to use our main method to test out our functionality. VIPTicket class We will create a VIP Ticket class which is a subclass of Ticket. VIP Tickets have mostly the same state and behavior of a Ticket, but they have an additional String instance field called freebies. This field will store what special freebie this ticket holder receives. Examples: Free Parking, Free Beverage, etc. We will add a getter and setter for this instance field. We will also add the following: A VIPTicket should be able to be created given no information or given an owner, cost, and freebie. o These constructors should appropriately initialize all of the inherited fields from the Ticket superclass by invoking the Ticket constructor with super(parameters go here...). The VIP Ticket constructor should also initialize the freebies field. A VIP Ticket should have a type of "VIP" . Override the getType() method that is inherited from Ticket We will add some testing code to our main method to test that objects of this type work as expected. Ticket Client We will now add additional functionality to the TicketClient class so we can create tickets according to the algorithm below, place them in an ArrayList, and then print the tickets in the ArrayList. Remove the testing code from the main and then declare an ArrayList of Tickets. . The number of tickets created should be a class constant at the top of the program so that it can be easily changed. We will create a method that takes the Ticket ArrayList as a parameter and creates new Tickets in each spot of the ArrayList, according to the following: 90% of the total tickets should be general admissions tickets (Ticket objects) o 10% of the total tickets should be VIP tickets (VIP Ticket objects) . We will make sure that the total number of tickets adds up to the constant at the top of the program. We will not hardcode in the amounts for each type of ticket - we will come up with a formula/write loops in a way that uses the class constant. We will create another method that takes the Ticket ArrayList as a parameter and prints all the tickets by utilizing the methods in the Ticket/VIP Ticket classes. The printed tickets will display: the seat, the cost, and the type of ticket as shown below. Sample Output TIE I SEAT # 1 CI COST: $50.00 K TYPE: General Admissions El TI TIE I SEAT # 2 CI COST: $50.00 K| TYPE: General Admissions TI TIE I SEAT # 3 CI COST: $50.00 KI TYPE: General Admissions EL TI TU TIE I| SEAT # 4 CI COST: $50.00 K TYPE: General Admissions EL TIE THE I SEAT # 5 CI COST: $50.00 K TYPE: General Admissions EL TI TIE I SEAT # 6 CT COST: $50.00 K TYPE: General Admissions EI TIE TI IT SEAT # 7 CI COST: $50.00 K| TYPE: General Admissions EL TI TIE I SEAT # 8 CI COST: $50.00 KL TYPE: General Admissions EI TI I SEAT # 9 CI COST: $50.00 KI TYPE: General Admissions El TI TI I SEAT # 10 CI COST: $50.00 K TYPE: General Admissions El TI TIE I SEAT # 11 CI COST: $50.00 K TYPE: General Admissions EI TIE TIE I SEAT # 12 CI COST: $50.00 K TYPE: General Admissions TIE . TI I SEAT # 13 C COST: $50.00 KL TYPE: General Admissions EI TIE TIE Il SEAT # 14 CI COST: $50.00 K TYPE: General Admissions El TIE TIE I SEAT # 15 CI COST: $50.00 K TYPE: General Admissions E TIE TIE I SEAT # 16 CT COST: $50.00 K TYPE: General Admissions EI TIE TIE I SEAT # 17 CI COST: $50.00 K TYPE: General Admissions El TI TIE Il SEAT # 18 CT COST: $50.00 KI TYPE: General Admissions EI TI TIE I SEAT # 18 CI COST: $50.00 K TYPE: General Admissions EL TI TIE I SEAT # 19 CI COST: $150.00 KI TYPE: VIP El Free Beverage TIE = !! 11 11 TIE Il SEAT # 20 CI COST: $150.00 KI TYPE: VIP El Free Parking TIE Submission You should submit your complete IntelliJ project which will have the following files: 1. Your Ticket Class 2. Your VIPTicket Class 3. Your TicketClient Class 4. Your Ticket jUnit Class 5. Your VIP Ticket jUnit Class - This is OPTIONAL Instruction We will write a program that will simulate a Ticketing System for an entertainment venue (e.g. Key Arena, Tacoma Dome, TMobile Park, etc). We will design a Ticket class and a VIPTicket. We will then write a main client program that will create a set number of Tickets and print out an ASCII art version of the tickets. After we get this working, we will use jUnit tests to test each method in the Ticket and VIP Ticket class. Ticket class We will write a Ticket class in the tickets package, where: A ticket has the following instance fields: seat number, cost, and owner. o What access modifier do we typically use

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago