1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Dafna11 [192]
3 years ago
7

Each ticket has a unique number and a price. There are three types of tickets: walk-up tickets, advance tickets, and student adv

ance tickets. Walk-up tickets are purchased the day of the event and cost $50. 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. 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 they cost $20. Implement a 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 by number. The ability to ask for a ticket's price. The ability to println a ticket object as a String. An example String would be "Number: 17, Price: 50.0".
a. Implement a 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.
b. Implement a 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.
c. Implement a 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.
Computers and Technology
1 answer:
liberstina [14]3 years ago
7 0

Answer:

import java.util.Scanner;

public abstract class Ticket   //abstract base class

   private int number;

   public Ticket(int number)

   

       this.number = number;

   

   public int getNumber()

   

       return number;

   

   public abstract double getPrice();

   public abstract String toString();

public class WalkupTicket extends Ticket

   public WalkupTicket(int number)

   

       super(number);

   

   public double getPrice()

   

       return 50;

   

   public String toString()

   

       return Number : +getNumber() +, Price : +getPrice();

   

public class AdvanceTicket extends Ticket

   private int days;

   public AdvanceTicket(int number)

   

       super(number);

   

   public AdvanceTicket(int number,int days)

   

       super(number);

       this.days = days;

   

   public double getPrice()

   

       if(days>=10)

       return 30;

       else

       return 40;

   

   public String toString()

   

       return Number : +getNumber() +, Price : +getPrice();

   

public class StudentAdvanceTicket extends AdvanceTicket

   private int days;

   public StudentAdvanceTicket(int number,int days)

   

       super(number);

       this.days = days;

   

   public double getPrice()

 

Explanation:

import java.util.Scanner;

public abstract class Ticket   //abstract base class

   private int number;

   public Ticket(int number)

   

       this.number = number;

   

   public int getNumber()

   

       return number;

   

   public abstract double getPrice();

   public abstract String toString();

public class WalkupTicket extends Ticket

   public WalkupTicket(int number)

   

       super(number);

   

   public double getPrice()

   

       return 50;

   

   public String toString()

   

       return Number : +getNumber() +, Price : +getPrice();

   

public class AdvanceTicket extends Ticket

   private int days;

   public AdvanceTicket(int number)

   

       super(number);

   

   public AdvanceTicket(int number,int days)

   

       super(number);

       this.days = days;

   

   public double getPrice()

   

       if(days>=10)

       return 30;

       else

       return 40;

   

   public String toString()

   

       return Number : +getNumber() +, Price : +getPrice();

   

public class StudentAdvanceTicket extends AdvanceTicket

   private int days;

   public StudentAdvanceTicket(int number,int days)

   

       super(number);

       this.days = days;

   

   public double getPrice()

 

You might be interested in
Engineers and scientists redesign a prototype if it does not work correctly true or false and why
Rasek [7]
True they would not start to use a product if it would not work
Hope this helps please mark this as brainliest answer
4 0
4 years ago
Read 2 more answers
List analog devices, Digital devices and hybrid devices
andrey2020 [161]

Answer:

Types of Hybrid Computers:

1. Large Electronic Hybrid Computer

2. General-Purpose Hybrid Computers

3. Special-Purpose Hybrid Computers

Examples of Hybrid Computers

1. Gasoline Station

2. Electrocardiogram Machine

3. Ultrasound Machine

4. Monitoring Machine

5. Research and Production Industries

6. Forensic

7. Defence

Types of Analogue Computers

1. Slide Rules

2. Differential Analysers

3. Castle Clock

4. Electronic Analogue Computers

5. Mechanical Analogue Computers

Examples of Analogue Computers

1. Thermometer

2. Speedometer

3. Analogue Clock

4. Seismometer

5. Voltmeter

6. Flight Simulators

7. Tide Predictors

Types of Digital Computers

1. Micro Computer

2. Mini Computer

3. Mainframe Computer

4. Super Computer

Examples of Digital Computers

1. Calculator

2. Digital Clock

3. Automobiles

4. Weighing Machine

5. Consumer Electronic Equipments

6. Smart Phones

7. Laptop/Personal Computer

8. ATM

3 0
2 years ago
Why was unicode invented
GrogVix [38]
The old system, ASII, was no where near large enough to deal with all the different languages & symbols that exist  
5 0
4 years ago
Read 2 more answers
Events and conditions that happen within an organization that are somewhat easier to deal with when responding to change are cal
IgorC [24]
These are called abstractions. They can be created by functions, if statements, or on event structures.
3 0
3 years ago
WHAT IS ONE WAY A PIVOTTABLE COULD COMBINE THE FOLLOWING DATA
Gemiola [76]

Answer: You sort table data with commands that are displayed when you click a header arrow button. Hope it help's :D

7 0
3 years ago
Other questions:
  • Data are sent through a network on bundles called ____packets____. select one:
    14·2 answers
  • A _____ is a group of two or more devices/computers connected together to allow for the exchange and information and for the sha
    5·2 answers
  • Before you enable data deduplication, what tool can you use to determine if data deduplication would benefit the tested volumes
    11·1 answer
  • The thinner the thread on the screw, the ______the force needed but the _____the distance.
    15·1 answer
  • Write the Java code to simulate an inventory control system and a point of sale system with customer history On program start, e
    5·1 answer
  • Indicates the beginning and ending of your code written in HTML
    12·1 answer
  • Kylee needs to ensure that if a particular client sends her an email while she is on vacation, the email is forwarded to a cowor
    7·1 answer
  • Which situation is the best choice for using telehealth?
    12·1 answer
  • A form of segmentation that is based on user usage rate, user status, purchase occasion, and benefits sought is _________.
    13·1 answer
  • What do you mean by computer ethics?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!