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
In Python, what kind of error is returned by the following code? (e.g. NameError, ValueError, IOError, etc.) def my_func(n1, n2)
kodGreya [7K]

Answer:

SyntaxError.

Explanation:

https://www.quora.com/In-Python-what-kind-of-error-is-returned-by-the-following-code-e-g-NameError-ValueError-IOError-etc-def-my_func-n1-n2-return-n1-n2-my_func-1-2-3          sorce site

<h2></h2><h2></h2><h2></h2><h2>brainlest plz</h2>
6 0
4 years ago
Translate function f into RISC-V assembly language. Assume the function declaration for g is int g(int a, int b). e code for fun
Shkiper50 [21]

Answer:

int f(int a, int b, int c) {

return func(func(a, b), c);

}

f: addiu $sp, $sp, -8 # allocate frame = 8 bytes

sw $ra, 0($sp) # save return address

sw $a2, 4($sp) # save c

jal func # call func(a,b)

move $a0, $v0 # $a0 = result of func(a,b)

lw $a1, 4($sp) # $a1 = c

jal func # call func(func(a,b),c)

lw $ra, 0($sp) # restore return address

addiu $sp, $sp, 8 # free stack frame

jr $ra # return to caller

4 0
3 years ago
6. By default,how the table headings are placed. (2 Points)
Dmitrij [34]
They are all bold and what ever else
6 0
3 years ago
Describe four features of a well designed input screen
Sladkaya [172]

Answer:

A well design input screen should:1.Be titled2.Navigation aids should be used

Explanation:

3 0
3 years ago
Read 2 more answers
The information included in a résumé should always relate to the job objective; if it isn’t related, it shouldn’t be included.
ICE Princess25 [194]

Answer:

True.

Explanation:

A resume (curriculum vitae) can be defined as a short text-based document that a job applicant use to briefly outline his or her qualifications, abillities and accomplishments, haven completed and obtained an academic certificate. Thus, it is used to briefly outline a person's qualifications, abillities, skills set, and accomplishments, after completing and obtaining an academic certificate such as a bachelor's degree, master's degree, etc.

Generally, all job applicants are required to have a resume (curriculum vitae). This brief and concise document is always requested by human resource managers during the job application process.

Furthermore, the primary way to make a resume persuasive (to convince or inform an action in the minds of the readers - potential employers) is by customizing it to fit each company and position.

Hence, the information included in a résumé should always relate to the job objective; if it isn’t related, it shouldn’t be included.

This ultimately implies that, job applicants are expected to tailor their resume to fit or match the position that is advertised by a company's human resources department.

5 0
3 years ago
Other questions:
  • The security administrator for PLABS.com recommends using a host-based firewall for all servers and workstations. What can a hos
    6·1 answer
  • It is important that data being imported from a text file into access are separated by a character, such as a comma, which defin
    8·1 answer
  • in cell h5, enter a formula that will calculate the percentage of attendees that went to the Altamonte springs job fair in 2018.
    15·2 answers
  • 6-3.1 After visiting a large number of Web sites to complete your research for a lengthy research paper, your computer begins to
    14·2 answers
  • What’s the most popular operating system
    9·2 answers
  • XYZ Corp.’s facilities in Nashua, New Hampshire, are two office buildings 400 feet apart, each with its own LAN. To connect the
    9·1 answer
  • James would like to send a document he has saved on the hard drive to coworkers in Ireland, Brazil, and India. These coworkers h
    6·2 answers
  • Hey i need some help with code.org practice. I was doing a code for finding the mean median and range. the code is supposed to b
    14·1 answer
  • Which tab do you open to access the Comments feature?
    11·1 answer
  • Which statement best describes one reason why assembly language is easier
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!