Consider the Java class ConcertPromoter that records the tic

Consider the Java class \"ConcertPromoter\" that records the tickets sold for a perfromance. Before the day of the concert, tickets are sold only over the phone. Sales on the day of the performance are made only in person at the end of the concert venue. The class has the following attributes:

- The name of the band

- The capacity of the venue

- The number of tickets sold

- The price of a ticket sold by phone

- The price of a ticket sold at the concert venue

- The total sales amount

It has methods to:

- Record the sale of one or more tickets

- Change from phone sales to sales at the concert venue

- Return the number of tickets sold

- Return the number of tickets remaining.

- Return the total sales for the concert

A. Write a method heading for each method.

B. Write preconditions and postconditions for each method.

C. Write some Java statements that test the class.

D. Impelement the class

E. List any additional methods and attributes needed in the implementation that were not listed in the original design. List any other changes made to the original design.

F. Write a program using the class you wrote for Part d that will be used to record sales for a concert. Your program should record phone sales, the sales at the venue. As tickets are sold, the number of seats remaining should be displayed. At the end of the program, display the number of tickets sold and the total sales amount for the concert

Solution

The class below covers the first 4 parts of the question that is:

A. Write a method heading for each method.

B. Write preconditions and postconditions for each method.

C. Write some Java statements that test the class.

D. Impelement the class

public class ConcertPromoter{
  
    String bandName;
    int capacity;
    static int ticketsSold = 0;
    float ticketPriceOnPhone;
    float ticketPriceAtVenue;
    float totalSalesAmount;
    //additional attributes required
    string salesType;
  
  
    public void recordSales(){
        ticketsSold++;
    }

    public String changeSalesType(daysRemaining){
        if(daysRemaining == 1)
        salesType = \"Phone\";
        else if(daysRemaining == 0)
        salesType = \"Venue\";
        return salesType;
    }

    public int getTicketsSold(){
        return ticketsSold;
    }

    public int getTicketsRemaining(){
        return (capacity-ticketsSold);
    }

    public float getTotalSalesAmount(){
        return totalSalesAmount;
    }
}

Consider the Java class \
Consider the Java class \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site