I need help with this. can I have this in Dr. Java, please Objective: Write a cl
ID: 3724030 • Letter: I
Question
I need help with this. can I have this in Dr. Java, please
Objective:
Write a class that keeps track of concert promotion information
First down load the driver and put it in your project
Notice that this has all of the dialog outputs and user inputs already written
You are writing the backend not he front end
Write a class file called Concert that DOES NOT HAVE a main method
Some of the attributes of Concert are
Name
Capacity
Number of Tickets Sold By Phone
Number of Tickets Sold At the Venue
The price of a ticket by phone
The price of a ticket at the venue
Create the following Constructors
Default – sets everything to default values
One that has the parameters (in this order)
Band name
Capacity
Price by phone
Price at the venue
One that has parameters (in this order)
Name
Capacity
Number of Tickets Sold By Phone
Number of Tickets Sold At the Venue
The price of a ticket by phone
The price of a ticket at the venue
Accessors and Mutators for each variable
MAKE SURE THE MUTATORS CHECK FOR VALID VALUES!
Create the following MethodsTotalNumberOfTicketsSold
No parameters
Returns the value of the phone tickets plus the venue tickets
TicketsRemaining
No parameters
Returns the value of the capacity minus the total number of tickets sold
BuyTicketsAtVenue
1 parameter that corresponds to the number of tickets being bought
returns nothing
BuyTicketsByPhone
1 parameter that corresponds to the number of tickets being bought
returns nothing
TotalSales
No parameters
Returns the value of the ticket at the venue times the number of tickets sold at the venue, plus the tickets by phone times the price of a phone ticket
Example Dialog:
Welcome to the Concert Promotion tool!
Currently the concert featuring the band No name yet
Has sold 0 tickets by phone
Has sold 0 tickets at the venue
And has grossed $0.0
What would you like to do?
Enter 1: To change name
Enter 2: To change ticket by phone price
Enter 3: To change ticket at venue price
Enter 4: To add tickets by phone
Enter 5: To add tickets at the venue
Enter 6: To find out how many tickets are remaining
Enter 7: To find out how many total tickets have been sold
Enter 8: To change the venue's capacity
Enter 9: To start a new concert
Enter 0: To Quit
1
Enter the name of the band
Bob's Band
Currently the concert featuring the band Bob's Band
Has sold 0 tickets by phone
Has sold 0 tickets at the venue
And has grossed $0.0
What would you like to do?
Enter 1: To change name
Enter 2: To change ticket by phone price
Enter 3: To change ticket at venue price
Enter 4: To add tickets by phone
Enter 5: To add tickets at the venue
Enter 6: To find out how many tickets are remaining
Enter 7: To find out how many total tickets have been sold
Enter 8: To change the venue's capacity
Enter 9: To start a new concert
Enter 0: To Quit
8
Enter the new capacity
500
Currently the concert featuring the band Bob's Band
Has sold 0 tickets by phone
Has sold 0 tickets at the venue
And has grossed $0.0
What would you like to do?
Enter 1: To change name
Enter 2: To change ticket by phone price
Enter 3: To change ticket at venue price
Enter 4: To add tickets by phone
Enter 5: To add tickets at the venue
Enter 6: To find out how many tickets are remaining
Enter 7: To find out how many total tickets have been sold
Enter 8: To change the venue's capacity
Enter 9: To start a new concert
Enter 0: To Quit
2
Enter the new price by phone
5
Currently the concert featuring the band Bob's Band
Has sold 0 tickets by phone
Has sold 0 tickets at the venue
And has grossed $0.0
What would you like to do?
Enter 1: To change name
Enter 2: To change ticket by phone price
Enter 3: To change ticket at venue price
Enter 4: To add tickets by phone
Enter 5: To add tickets at the venue
Enter 6: To find out how many tickets are remaining
Enter 7: To find out how many total tickets have been sold
Enter 8: To change the venue's capacity
Enter 9: To start a new concert
Enter 0: To Quit
3
Enter the new price at the venue
10
Currently the concert featuring the band Bob's Band
Has sold 0 tickets by phone
Has sold 0 tickets at the venue
And has grossed $0.0
What would you like to do?
Enter 1: To change name
Enter 2: To change ticket by phone price
Enter 3: To change ticket at venue price
Enter 4: To add tickets by phone
Enter 5: To add tickets at the venue
Enter 6: To find out how many tickets are remaining
Enter 7: To find out how many total tickets have been sold
Enter 8: To change the venue's capacity
Enter 9: To start a new concert
Enter 0: To Quit
4
Enter a number of tickets to add by phone
200
Currently the concert featuring the band Bob's Band
Has sold 200 tickets by phone
Has sold 0 tickets at the venue
And has grossed $1000.0
What would you like to do?
Enter 1: To change name
Enter 2: To change ticket by phone price
Enter 3: To change ticket at venue price
Enter 4: To add tickets by phone
Enter 5: To add tickets at the venue
Enter 6: To find out how many tickets are remaining
Enter 7: To find out how many total tickets have been sold
Enter 8: To change the venue's capacity
Enter 9: To start a new concert
Enter 0: To Quit
5
Enter a number of tickets to add at the venue
200
Currently the concert featuring the band Bob's Band
Has sold 200 tickets by phone
Has sold 200 tickets at the venue
And has grossed $3000.0
What would you like to do?
Enter 1: To change name
Enter 2: To change ticket by phone price
Enter 3: To change ticket at venue price
Enter 4: To add tickets by phone
Enter 5: To add tickets at the venue
Enter 6: To find out how many tickets are remaining
Enter 7: To find out how many total tickets have been sold
Enter 8: To change the venue's capacity
Enter 9: To start a new concert
Enter 0: To Quit
4
Enter a number of tickets to add by phone
1000
The concert is sold out!
Currently the concert featuring the band Bob's Band
Has sold 200 tickets by phone
Has sold 200 tickets at the venue
And has grossed $3000.0
What would you like to do?
Enter 1: To change name
Enter 2: To change ticket by phone price
Enter 3: To change ticket at venue price
Enter 4: To add tickets by phone
Enter 5: To add tickets at the venue
Enter 6: To find out how many tickets are remaining
Enter 7: To find out how many total tickets have been sold
Enter 8: To change the venue's capacity
Enter 9: To start a new concert
Enter 0: To Quit
Explanation / Answer
Explanation:
Please find the below Concert class with all the instance variables, constructors, accessors, muttetors and other required methods.
Please note as mentioned Driver link to download is not provided. So please provide that in the comments section if already have, otherwise let me know to develop from fresh.
Program:
public class Concert {
private String bandName;
private int capacity;
private int ticketSoldByPhoneCount;
private int ticketSoldAtVenueCount;
private double ticketPriceByPhone;
private double ticketPriceAtVenue;
public Concert() {
this.bandName = "";
this.capacity = 0;
this.ticketSoldByPhoneCount = 0;
this.ticketSoldAtVenueCount = 0;
this.ticketPriceByPhone = 0;
this.ticketPriceAtVenue = 0;
}
public Concert(String bandName, int capacity, double ticketPriceByPhone,
double ticketPriceAtVenue) {
this.bandName = bandName;
this.capacity = capacity;
this.ticketSoldByPhoneCount = 0;
this.ticketSoldAtVenueCount = 0;
this.ticketPriceByPhone = ticketPriceByPhone;
this.ticketPriceAtVenue = ticketPriceAtVenue;
}
public Concert(String bandName, int capacity, int ticketSoldByPhoneCount,
int ticketSoldAtVenueCount, double ticketPriceByPhone,
double ticketPriceAtVenue) {
this.bandName = bandName;
this.capacity = capacity;
this.ticketSoldByPhoneCount = ticketSoldByPhoneCount;
this.ticketSoldAtVenueCount = ticketSoldAtVenueCount;
this.ticketPriceByPhone = ticketPriceByPhone;
this.ticketPriceAtVenue = ticketPriceAtVenue;
}
public String getBandName() {
return bandName;
}
public int getCapacity() {
return capacity;
}
public int getTicketSoldByPhoneCount() {
return ticketSoldByPhoneCount;
}
public int getTicketSoldAtVenueCount() {
return ticketSoldAtVenueCount;
}
public double getTicketPriceByPhone() {
return ticketPriceByPhone;
}
public double getTicketPriceAtVenue() {
return ticketPriceAtVenue;
}
public void setBandName(String bandName) {
this.bandName = bandName;
}
public void setCapacity(int capacity) {
if (capacity > 0) {
this.capacity = capacity;
} else {
System.out.println("Capcity can't be negetive!");
}
}
public void setTicketSoldByPhoneCount(int ticketSoldByPhoneCount) {
if (ticketSoldByPhoneCount <= capacity) {
this.ticketSoldByPhoneCount = ticketSoldByPhoneCount;
} else {
System.out.println("No more tickets available!");
}
}
public void setTicketSoldAtVenueCount(int ticketSoldAtVenueCount) {
if (ticketSoldAtVenueCount <= capacity) {
this.ticketSoldAtVenueCount = ticketSoldAtVenueCount;
} else {
System.out.println("No more tickets available!");
}
}
public void setTicketPriceByPhone(double ticketPriceByPhone) {
if (ticketPriceByPhone > 0) {
this.ticketPriceByPhone = ticketPriceByPhone;
} else {
System.out.println("Ticket price can't be negetive!");
}
}
public void setTicketPriceAtVenue(double ticketPriceAtVenue) {
if (ticketPriceByPhone > 0) {
this.ticketPriceAtVenue = ticketPriceAtVenue;
} else {
System.out.println("Ticket price can't be negetive!");
}
}
public int totalNumberOfTicketsSold() {
return this.ticketSoldByPhoneCount + this.ticketSoldAtVenueCount;
}
public int TicketsRemaining() {
return this.capacity - this.totalNumberOfTicketsSold();
}
public void buyTicketsAtVenue (int ticketCount) {
if (ticketCount <= capacity) {
this.capacity = this.capacity - ticketCount;
this.ticketSoldAtVenueCount = this.ticketSoldAtVenueCount + ticketCount;
} else {
System.out.println("No more tickets available!");
}
}
public void buyTicketsByPhone (int ticketCount) {
if (ticketCount <= capacity) {
this.capacity = this.capacity - ticketCount;
this.ticketSoldByPhoneCount = this.ticketSoldByPhoneCount + ticketCount;
} else {
System.out.println("No more tickets available!");
}
}
public double totalSales () {
return (this.ticketSoldByPhoneCount*this.ticketPriceByPhone +
this.ticketSoldAtVenueCount*this.ticketPriceAtVenue);
}
}