Question: D Do in Java with three classes (Stadium, Stadium Demo, Event). Use the given event class. Create a Stadium Class using the UML diagram below.

D

Do in Java with three classes (Stadium, Stadium Demo, Event). Use the given event class.

D Do in Java with three classes (Stadium, Stadium Demo, Event). Usethe given event class. Create a Stadium Class using the UML diagrambelow. Stadium - String: name - int: totalSeats - int: maxEvents -

Create a Stadium Class using the UML diagram below. Stadium - String: name - int: totalSeats - int: maxEvents - int: currEvents - Event []: events + Stadium (String, int, int): + getTotalSeats(): int + getMaxEvents(): int + getEvents(): Event [] + getName(): String + getCurrEvents(): int + setName(String): void + toString (): String + getRevenue(): double + addEvent(Event): boolean - The constructor takes in a Stadium name and an int that represents the maximum number of events, and an int that represents the totalSeats. It also initializes the array to the maximum number of events and initializes currEvents to 0 . - The method getRevenue calculates and returns the revenue from all the events in the aray. - The method addEvent will add an Event to the Stadium's array if there is room (returns true - the event was added or false the event was not added). Remember to update currEvents - The toString method return the name of the stadium, the number of seats, and the number of events. Below is an example of the output for HalifaxCentre with 10000 seats that has 25 events. | HalifaxCentre Seats: 10000 Events: 25 | HalifaxCentre Seats: 10000 Events: 25 Then create a Stadium Demo class. - Use a Scanner object to read the information to create a Stadium object - Read in an int (N) that will represent how many Events to add to the Stadium. Then read in the data for N Event objects and add it them to the Stadium (call addEvent method). - Print the Stadium object using the toString method. - Then print out all the Event objects at the Stadium. - Print the revenue from all the Event objects (hint: use printf to control the decimal places to 2 ) Note: Assume the Stadium name is all one word

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!