Question: Java question. Can someone code this? Instructions You are going to write a program that will simulate the very beginnings of a Ticketing System for

Java question. Can someone code this?

Instructions

You are going to write a program that will simulate the very beginnings of a Ticketing System for an entertainment venue (think Key Arena, Tacoma Dome, Quest Field, etc). You will design a Ticket class and a VIP ticket. You 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.

In theory, we could continue to build on this program to create a more complicated system that allows people to purchase tickets (become owners of tickets), calculate sales, and much more like TicketMaster or StubHub.

Ticket class

You need to write a Ticket class, where:

A ticket has the following instance fields: seat number, cost, and owner.

The Ticket class should also share a class variable(Hint: use private static int nextSeat=1;) with all Tickets for the next available seat (this changes every time a ticket is issued).

A Ticket should be able to be created given no information.

Two constructors should be created: one with no parameters(default or zero-parameter constructor) and one that takes a single string (owner name) and a double cost(ticket cost). You can assign the seatNumber using the class variable nextSeat. Tickets should be created starting with seat #1, and every subsequent ticket should be one seat higher.

Tickets should cost $50 by default.

You determine what the starting value of the owner field is for the constructor with no params (make it logical)

A Ticket should have accessors(getters) for all instance fields: seat number, owner, and cost.

A Ticket should have mutators(setters) for the owner and the cost.

A Ticket should have a getType method which returns a String that returns "General Admission" as the ticket type.

Other types of tickets will have different strings to return so you will override this method.

A Ticket should have a toString method which will return a String that can be used to display a ticket.

You determine how a ticket should display but you can use the tickets below as a guide.

Tester Code

After you create (or as you create) your Ticket class, you should write tester code to make sure that your Ticket performs as expected. In this file, everything can be done in the main - it just needs to appropriately test all the functionality of your Ticket class by creating a Ticket object and then calling various methods on it.

VIPTicket class

Create a VIPTicket class which is a subclass of Ticket. VIPTickets have mostly the same state and behavior of a Ticket, but it has an additional String instance variable called freebies. This field will store what special freebie this ticket holder receives. Examples: Free Parking, Free Beverage, etc. You should add a getter and setter for this instance field. You should also make sure you add the following :

A VIPTicket should be able to be created given no information or given an owner, cost, and freebie.

These constructors should appropriately initialize all of the inherited fields from the Ticket superclass calling the Ticket constructor with the keyword super(parameters go here...). The VIPTicket constructor should also initialize the freebies String instance field.

A VIPTicket should have a type of "VIP"

Override the getType() method that is inherited from Ticket

You should add some testing code to your tester file to test that objects of this type work as expected.

Ticket Client

You should create a Client program to create tickets and then print those tickets.

This class should contain a main method and should 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.

You should have 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)

10% of the total tickets should be VIP tickets (VIPTicket objects)

Make sure that the total number of tickets adds up to the constant at the top of the program! Do not hardcode in the amounts for each type of ticket - come up with a formula or write your loops in a way that uses the class constant.

You should have another method that takes the Ticket ArrayList as a parameter and prints all the tickets by utilizing the methods in the Ticket/VIPTicket classes.

Your printed tickets must display: the seat, the cost, and the type of ticket

Sample Output

T|========================== I| SEAT # 1 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 2 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 3 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 4 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 5 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 6 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 7 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 8 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 9 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 10 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 11 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 12 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 13 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 14 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 15 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 16 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 17 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 18 C| COST: $50 K| TYPE: General Admissions E| T|========================== T|========================== I| SEAT # 19 C| COST: $150 K| TYPE: VIP E| Free Beverage T|========================== T|========================== I| SEAT # 20 C| COST: $150 K| TYPE: VIP E| Free Parking T|==========================

Submission

You should submit THREE FILES:

Your Ticket Class

Your VIPTicket Class

Your Ticket Client

Please help me

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!