Question
Mainly need help with part E of this program 2. Consider the task of representing types of tickets to campus events. Each ticket has a
Mainly need help with part E of this program
2. Consider the task of representing types of tickets to campus events. Each ticket has a unique number and a price. There are three types of tickets: walk-up tickets, advance tickets, and student advance tickets. Below figure illustrates the types:
a) Implement the class called Ticket that will serve as the superclass for all three types of tickets. Define all common operations in this class, and specify all differing operations in such a way that every subclass must implement them. No actual objects of type Ticket will be created: Each actual ticket will be an object of a subclass type. Define the following operations: The ability to construct a ticket number by incrementing the value of the number of tickets created so far.. The ability to ask for a tickets price. The ability to println a ticket object as a String . An example String would be "Number: 17, Price: 50.0".
b) Implement the class called WalkupTicket to represent a walk-up event ticket. Walk-up tickets are also constructed by number, and they have a price of $50.
c) Implement the class called AdvanceTicket to represent tickets purchased in advance. An advance ticket is constructed with a ticket number and with the number of days in advance that the ticket was purchased. Advance tickets purchased 10 or more days before the event cost $30, and advance tickets purchased fewer than 10 days before the event cost $40.
d) Implement the class called StudentAdvanceTicket to represent tickets purchased in advance by students. A student advance ticket is constructed with a ticket number and with the number of days in advance that the ticket was purchased. Student advance tickets purchased 10 or more days before the event cost $15, and student advance tickets purchased fewer than 10 days before the event cost $20 (half of a normal advance ticket). When a student advance ticket is printed, the String should mention that the student must show his or her student ID (for example, "Number: 17, Price: 15.0 (ID required)").
e) Create a class TicketTester which has main method and creates objects for WalkupTicket, AdvanceTicket and StudentAdvanceTicket and prints price for each object and also the object . For example for object of StudentAdvanceTicket class, it should print the following for the ticketnumber 17: Price: 15.0 "Number: 17, Price: 15.0 (ID required)"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started