Create an interface called TicketPrices that sets constants for Child to 5.00, A
ID: 3581735 • Letter: C
Question
Create an interface called TicketPrices that sets constants for Child to 5.00, Adult to 10.00, and Senior to 8.00, Orchestra to 25.00, MainFloor to 15.00, and Balcony to 5.00.
Create an abstract class called BoxOffice with fields for the title, producer, duration, and number of tickets. Write get adn set methods for all fields. Write two constructors - one that has parameters for the title, producer, duration, and number of tickets; and a default constructor that sets the Title name to "Bambi", sets the Producer to "Disney", sets the duration to 54 minutes, and sets the number of tickets to 3. Include an abstract method called setTicketCost().
Explanation / Answer
interface TicketPrices
{
public static int cp = 5;
public static int ap = 10;
public static int sp = 8;
public static int op = 25;
public static int mp = 15;
public static int bp = 5;
}
abstract class BoxOffice {
public String tital;
public String producer;
public int duration;
public int number_of_tickets;
public BoxOffice() {
tital="Bambi";
producer="Disney";
duration=54;
number_of_tickets=3;
}
public BoxOffice(String tital, String producer, int duration, int number_of_tickets) {
this.tital = tital;
this.producer = producer;
this.duration = duration;
this.number_of_tickets = number_of_tickets;
}
public String getTital() {
return tital;
}
public void setTital(String tital) {
this.tital = tital;
}
public String getProducer() {
return producer;
}
public void setProducer(String producer) {
this.producer = producer;
}
public int getDuration() {
return duration;
}
public void setDuration(int duration) {
this.duration = duration;
}
public int getNumber_of_tickets() {
return number_of_tickets;
}
public void setNumber_of_tickets(int number_of_tickets) {
this.number_of_tickets = number_of_tickets;
}
abstract void setTicketCost();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.