Reference no: EM13380754
Beginning with your code add a JMenubar to your main window with a Game menu which contains 5 JRadioButtonMenuItems as "Game 1", "Game 2", "Game 3", "Game 4" and "All 4 Games". Here is what your interface may look like (note that the Game menu has been selected so you can see what it has inside it):
You will need to adjust your Seat class to show its availability for exactly 4 games. Each seat may be purchased for up to 4 games/events. Add, to the Seat class, a boolean array attribute called sold that keeps track of whether or not the seat has been sold for each of the exactly 4 games/events (i.e., the array will be of size 4). By default, a seat should not be sold for any of the 4 games. Therefore, when you start the application, the stadium should have all seats available for all 4 games.
![772_Main window with a Game menu.png](https://secure.expertsmind.com/CMSImages/772_Main%20window%20with%20a%20Game%20menu.png)
Adjust your code so that when the Purchase button is pressed on the main application window, then the seats that are currently selected become sold and so they are no longer available for that particular game. Make sure that the following behavior is working:
1. purchased (i.e., unavailable) seats appear as white squares.
2. seats are purchased ONLY for the particular game that is selected in the menu.
3. if "All 4 Games" is selected from the menu, then the seats should be purchased for all 4 games and hence become unavailable for all 4 games.
4. If "All 4 Games" is selected, then the price for each seat currently selected should be multiplied by 4 and a 10% discount (before taxes) should be applied.
5. if "All 4 Games" is selected from the menu, then only seats that are available (i.e., not sold) for ALL of the 4 games should be able to be selected and purchased. So if a seat has been sold even for just one game, then it should appear white when "All 4 Games" is selected from the menu.
6. whenever any game is selected from the menu, all currently selected seats should become unselected.
7. The Purchase button should be disabled if no seats are selected and enabled otherwise.
Change your code so that when the purchase button is pressed, a dialog box appears to allow the user to enter purchasing information and to confirm the purchase. If the purchase is indeed made, then the availability of the seats changes (as you already wrote). However, if the user cancels the purchase, then no change to the seating availability should be made.
Attachment:- Assignment.rar