Java There are three types of tickets: walk-up tickets, advance tickets, and student advance tickets. Walk-up tickets are purchased the day of the event and cost $50. Advance tickets are purchased 10 or more days ibefore the event and cost $30, and advance tickets purchased fewer than 10 days before the event cost $40. Student advance ticket

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Java

There are three types of tickets: walk-up tickets, advance tickets, and student advance tickets.

  • Walk-up tickets are purchased the day of the event and cost $50.
  • Advance tickets are purchased 10 or more days ibefore the event and cost $30, and advance tickets purchased fewer than 10 days before the event cost $40.
  • Student advance tickets are sold at half the price of normal advance tickets: when they are purchased 10 or more days early they cost $15, and when they are purchased fewer than 10 days early the cost $20.

Implement a class called Ticket that will serve as a super class for all ticket types. Define all common operations in this classs, 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 by number
  • The ability to ask for a ticket's price
  • The ability to println a ticket object as a String. Example: "Number: 17, Price: $50.0"

Implement a class called WalkupTicket to represent a walk-up event ticket. Walk-up tickets are constructed by number and they have a price of $50.

Implement a class called AdvanceTicket to represent tickets purchased in advance. An advance tickets is constructed with a ticket number and with the number of days in advance that the ticket was purchased. 

Implement a class called StudentAdvanceTicket to represent tickets purchased in advance by students. A student advance ticket is constructed with a ticket number and the number of days in advnce that the ticket was purchased. Student advance tickets purchased 10 or more days before the event cost $15, and tickets purchased fewer than 10 days before the cost $20. Example student print: "Number: 17, Price: $15.0 (ID required)"

 

Ticket
number
Ticket(number)
getPrice()
toString()
Walkup Ticket
Advance Ticket
Student Advance Ticket
Transcribed Image Text:Ticket number Ticket(number) getPrice() toString() Walkup Ticket Advance Ticket Student Advance Ticket
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education