Question: In Java: *ALL YOU NEED TO DO IS ANSWERING THE QUESTIONS. Topics This assignment will give you practice with classes, inheritance, arrays, and thinking/designing code
In Java:
*ALL YOU NEED TO DO IS ANSWERING THE QUESTIONS.
Topics
This assignment will give you practice with classes, inheritance, arrays, and thinking/designing code with an Object-Oriented approach.
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 VIPTicket. You will then write a main 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 a the following state fields: seat number, cost, and owner.
The Ticket class should also share a class variables 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. Only a constructor with no parameters needs to be defined.
Tickets should be created starting with seat #1, and every subsequent ticket should be one seat higher.
Tickets should cost $10 by default.
You determine what the starting value of the owner field is.
A Ticket should have accessors for all fields.
A Ticket should have mutators for only the owner. (You cannot change the price of a ticket after creation, nor the seat number assigned to a ticket.)
A Ticket should have a getType method which returns a String that returns "General Admission" as the ticket type.
A Ticket should have a discounts method which returns a String that indicates that Tickets (regular tickets) have no associated discounts. Other types of tickets will have discounts and you will override this method.
A Ticket should have a toString method which can be used to print a ticket. You determine how a ticket should print.
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. You will need to turn this code in. 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
Create a VIPTicket class which is a subclass of Ticket. VIPTickets have mostly the same state and behavior of a Ticket, except:
A VIPTicket should be able to be created given no information. Only a constructor with no parameters needs to be defined.
This constructor should appropriate initialize all of the inherited fields from the Ticket superclass.
A VIPTicket should cost three times the cost of a general Ticket.
A VIPTicket should have a type of "VIP"
A VIPTicket should receive a discount of Free Parking.
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 array 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 array as a parameter and create new Tickets according to the following:
95% of the total tickets should be general admissions tickets (Ticket objects)
5% 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 hardcore in the amounts for each type of ticket - come up with a formula using the class constant.
You should have a method that takes the Ticket array as a parameter and prints all the tickets by utilizing the methods in the Ticket/VIPTicket classes.
QUESTIONS:
In addition to writing code for this assignment, you should also submit a text file that answers the following questions:
1. What is the advantage of designing a Ticketing System using an OOP approach?
2. We are not currently utilizing the owner field of tickets, but theoretically we might want to in the future. What did you make the initial value of your owner field and why? How might we use this field if we were to expand our Ticket client program?
3. Let's say we want to add the ability to purchase tickets. Describe what you would do to add this functionality to your program. (You don't actually need to code this.)
4. If you were to turn this program into a fully functional Ticketing System, describe at least one other class (not related to a Ticket itself) that you might want to create, including what state and behavior it would have. (You don't actually need to code this either, but you should be specific in your explanation, not general.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
