安徽热线 科技正文

代做 ticket management system

2024/04/15 07:41:47   来源:互联网


For this project, we will extend the ticket management system.
Ticket Management System now has two types of Users -
Admin - who can manage the concerts and prices
Customer - who can book tickets for the concerts.
Admin Operations - An admin can perform the following operations - 
Admin can view all the concerts
Admin can add a concert
Admin can remove a concert
Admin can view prices for seats for a concert and update them 
Admin can see the seat layouts
Customer Operations - A customer can perform all the operations that were allowed in the previous assignment and some more - 
Customers can view all the concerts (Similar to Assignment 1) 
Customers can view the prices for the concert seats (Similar to Assignment 1 with slight modifications)
Customers can see the seat layouts (Similar to Assignment 1 with slight modifications)
Customers can book multiple seats now 
Customers can see how much to pay for all the seats booked.
Due to the change in specifications and operations performed, there are certain changes introduced to Concert and Seats as well 
the total capacity for concerts can be set based on seat layout at the beginning
seat capacity decreases with more tickets booked
For simplicity, all concert has the same venue layout despite they are at different locations. This means that if there are 3 concerts, there should be 3 venues as the seats booked will be different in each one but the layout will remain the same for all three of them for sake of simplicity.


Main Program Execution
Your main program has slightly changed. Below are the specifications of how your program will be run initially.
Carried Forward: The section mentioned below is same as Assignment 1. Refer to the slides here
Inputs
Your program must take command line inputs in the order mentioned below. 
Rows - total number of rows for the seats. In this example, it is 5. 
Left column - total number of seats present in the left column. In this case, it is 4. 
Middle column - total number of seats present in the middle column. In this example, it is 5. 
Right column - total number of seats present in the right column. In this example, it is 4. 
This means when you compile your program and run it, the command on the terminal should look like this 
javac TicketManagementEngine.java 
java TicketManagementEngine 5 4 5 4 
In case there are insufficient inputs (missing input) or if any of the input is 0 or negative, then exit the program by printing the error message - 
javac TicketManagementEngine.java 
java TicketManagementEngine 5 4 5 
Invalid Inputs to set layout. Exiting the program now.
Note that in Assignment 1 the display message was being printed before the Invalid Inputs error message. But this is fixed now in Assignment 2. Please change your code accordingly.
To start with the Ticket Management System, you will need to print the display message. This part of the code is already provided to you. You must not remove this from the files.
Welcome to a revised version of Taylor Swift's Eras tour. 
 Modifications: Below section has slightly changed from Assignment 1.
Our program must run in either Customer Mode or Admin Mode. Our main menu has changed to the following :
Welcome to a revised version of Taylor Swift's Eras tour.
                                                                 
Select an option to get started!
Press 1 to enter Customer mode
Press 2 to enter Admin mode
Press 3 to exit
>  
Once the user has selected either Customer mode or Admin mode we will show them their respective menu so they can choose the operations available to them.
Exit Option 
In case, the user selects option 3, you must gracefully quit the program and print a goodbye message. Look at the complete output below. 
Select an option to get started!
Press 1 to enter Customer mode
Press 2 to enter Admin mode
Press 3 to exit
> 3
Goodbye from the Ticket Management System! See you next time!
Invalid Command 
In case, someone provides an invalid input like 4 or 7, you should be able to print “Invalid Input” and prompt the user again with the menu to select a valid input again. Sample output 
Welcome to a revised version of Taylor Swift's Eras tour.
                                                                 
Select an option to get started!
Press 1 to enter Customer mode
Press 2 to enter Admin mode
Press 3 to exit
> 4
Invalid Input.
Select an option to get started!
Press 1 to enter Customer mode
Press 2 to enter Admin mode
Press 3 to exit

Out Of Scope: Note that we only expect integers as input to this menu. There can be invalid integers that you need to handle, but there won't be any exceptions due to String/double or any other data type mismatch input provided to your program.

Customer Main Menu
Customer Main Menu
Modifications: There are additional menu items as compared to Assignment 1.
Once the user has chosen customer mode, we should show a slightly modified version of the menu that we have shown in Assignment 1. The first 4 menu items remain the same as in Assignment 1. There is an addition of menu item 5 and the exit option is now changed to menu item 6. 
Select an option to get started!
Press 1 to enter Customer mode
Press 2 to enter Admin mode
Press 3 to exit
> 1
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit

Option 1: Show timings 
Modifications : There are additional data points in show timings. You cannot hardcode this anymore as there are few other changes.
If the user selects option 1, you must show the below details to the user. 
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 1
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             0              65             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             0              65             
---------------------------------------------------------------------------------------------------------------------------
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit

Use the formatted input with settings "%-5s%-15s%-15s%-15s%-30s%-15s%-15s%-15s " to print the output in a nice format. 
Assumption: For option 2,3,4,5 whenever we need to select a concert to do a further action, the input for selecting the concert will always be correct ie in the above case either the concert selected would be 1 or 2 but never 3. 
Things to note - 
1.Notice that there are two additional columns - Seats Booked and Seats Left. 
2.The Total Seats are now set based on the Venue Layout input you have taken from the command line. In this example, the command line arguments were 5 4 5 4 which means we have 5 rows and total seats per row as 4+5+4 = 13. Total seats for the venue are 13 x 5 = 65 as shown in the above output. 
3.Every time a seat is booked, Seats booked should be increased and Seats Left can thus be derived from Total Seats - Seats booked.
4.Admin can add more concerts, so you must not hard code anything and handle it accordingly. See more in the Admin Section.
5.You must preload two concert details at the beginning of your program. See here.
See how the booked seats changes in the output below - 
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 1
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             2              63             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             1              64             
---------------------------------------------------------------------------------------------------------------------------
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit

Option 2: Ticket Costs 
Modifications : Prices of sections are not constant anymore. They are dynamic and set by the Admin. Also, ticket costs for different concerts can be different.
Your seat layout is divided into three sections - Left, Middle, and Right. Ticket cost varies as per the sections. This was discussed in the previous Assignment. However, the prices of seats can vary for different concerts. When the user selects input 2 from the main menu, you must ask the customer which concert they want to see the prices for and then show the prices for those concert seats accordingly.
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 2
Enter the concert number to see the prices for the seats
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             0              65             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             0              65             
---------------------------------------------------------------------------------------------------------------------------
> 1
Seat Costs
-----------------------
Left Zone:   AUD 200.0
Right Zone:  AUD 250.0
Middle Zone: AUD 500.0
-----------------------
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit

Note that if we choose concert 2 a different price will be shown. If the admin chooses to update the price of a concert, the prices will change and they should reflect correctly the next time the customer wants to see the price.
Option 3: Seats Layout
Modifications: The seat layout is created and printed the same way as Assignment 1. Refer to the details here for symbols used. However, different concerts have different booked seats.
When the user selects option 3 from the main menu you must ask the customer which concert's seat layout they want to see. Different concerts can have different bookings. Print the seat layout per the seat settings provided as input in the command line arguments and seats that have already been booked. Look how show timings also show the changes in Seats Booked and Seats Left.
See the output below if we choose Concert 1- 
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 3
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             2              63             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             1              64             
---------------------------------------------------------------------------------------------------------------------------
> 1
[BB__ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit

See the output below if we choose Concert 2
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 3
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             2              63             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             1              64             
---------------------------------------------------------------------------------------------------------------------------
> 2
[____ _B___ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit

Initially, when no booking is made, the seats are empty as mentioned in Assignment 1.
Option 6: Exit
Modifications : Do not exit from the entire program.
When you exit from the customer menu, you do not exit from the program. However, you must go back to choosing customer or admin mode. The program can continue to switch to admin mode or reselect the customer mode. All the changes made in a session remain available for other sessions. If a concert is added or prices are updated by an Admin, they must be visible to customer if we switch from admin mode to customer mode. See the output below 
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 6
Exiting Customer Mode
Select an option to get started!
Press 1 to enter Customer mode
Press 2 to enter Admin mode
Press 3 to exit

Book Tickets & Prices
Modifications: Three major changes. First, you need to select the concert for which the seat is booked. Second, you need to select X to book the seat and continue with the other seat selection. Third, The menu for W/A/S/D/Q is now changed into one single statement.
Once the user selects option 4 to book the tickets we must allow them to select a concert before they can select a seat. You can then prompt the user with a menu to move around the seating selection. 
To select a seat you may need to move around the layout and mark your seat. The cursor is marked by X. A seat booked is marked by B. As you move around the seat layout, the X moves. 
Look at the sample output below - 
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 4
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             0              65             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             0              65             
---------------------------------------------------------------------------------------------------------------------------
> 1
Continue to the seat selection! 
You can select the seat that are empty and marked by _
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.

Tip: in this case you will expect a String input - w/a/s/d/q/z. This can be upper or lower case. You must handle the input accordingly. 
By default, the leftmost available seat is pre-selected. If the leftmost seat is booked, the next available leftmost seat is available. Look at the output below.
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 4
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             1              64             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             0              65             
---------------------------------------------------------------------------------------------------------------------------
> 1
Continue to the seat selection! 
You can select the seat that are empty and marked by _
[BX__ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.

Carried Forward: Below section is same as Assignment 1. Refer to the slides here
The following movements are the same as per Assignment 1 Specs.
Invalid Input 
Movement - Right/Left/Top/Bottom
Invalid Moves 
Special Moves 
Exiting from Seat Selection - The selected seat is now marked with B instead of X.
Booking Multiple Seats
Modifications: Select a seat for booking. Option Z in the menu.
Since the customer can book multiple seats, and the cursor X can now move around to book other seats, we need to select the seat the customer wants to book. To select a seat, we will use option Z. Once a seat is booked, the seat is marked by B. The cursor then moves to the next available seat. Customers can then navigate around to book more seats. See the output below - 
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 4
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             1              64             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             0              65             
---------------------------------------------------------------------------------------------------------------------------
> 1
Continue to the seat selection! 
You can select the seat that are empty and marked by _
[BX__ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> d
[B_X_ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> d
[B__X _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> s
[B___ _____ ____]
[___X _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> z
[B___ _____ ____]
[___B X____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> d
[B___ _____ ____]
[___B _X___ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> z
[B___ _____ ____]
[___B _BX__ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> q
Your seat selection is saved.
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit

Prices
Addition: This specification is entirely new to Assignment 2.
When the user selects menu item 5, you must find all the seats booked for a concert and then find the total pricing of the booked seats per the prices for different seating zones (Left/Middle/Right). For example, for the seats booked in the previous section, 
[B___ _____ ____]
[___B _B___ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
the price is calculated as 2 x left zone price for concert 1 (ie 200) + 1 for the middle zone price for concert 2 (ie 500). = 2 x 200 + 500 = 900. See the output below - 
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 5
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             3              62             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             0              65             
---------------------------------------------------------------------------------------------------------------------------
> 1
Total price for all the booked seats is AUD 900.00
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit

If a concert is selected where no booking has been made simply show the error message - No bookings made for this concert
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 5
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      32             3              29             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                32             0              32             
---------------------------------------------------------------------------------------------------------------------------
> 2
No bookings made for this concert
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit

Special Cases : Seat Movements and Selection Use Cases.
Valid Seat Movements
1. If a user does not select any seat and exits the menu and comes back - the left-most available seat should be selected.
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 4
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             0              65             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             2              63             
---------------------------------------------------------------------------------------------------------------------------
> 1
Continue to the seat selection! 
You can select the seat that are empty and marked by _
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> q
Your seat selection is saved.
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 4
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             0              65             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             2              63             
---------------------------------------------------------------------------------------------------------------------------
> 1
Continue to the seat selection! 
You can select the seat that are empty and marked by _
[X___ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
>
2. If a seat is booked already and the user comes back to select more seats - the left most available seat should be selected.
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 4
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             0              65             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             2              63             
---------------------------------------------------------------------------------------------------------------------------
> 2
Continue to the seat selection! 
You can select the seat that are empty and marked by _
[BBX_ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.

Out of Scope Seat Movements
Out of Scope: Use cases that are not tested and are out of scope because they are complex to implement in the assignment.
1. If an entire row is booked, where should be the marker X? Perhaps the next row. But this won't be tested.
2. If a seat is booked and then a few seats later another seat is booked and you are navigating right to left or left to right in the same row.
3. If a seat is booked in the middle of rows and you are moving up to down or down to up.
4. When booking seats, if you are booking the bottom right seat, there is no place where the cursor X can go next. Thus, this case is not tested.
5. Also, with booking a seat, if the seat to be booked is to the immediate left of another seat, X skip the seat on the right to get to the next available seat. This is complicated to implement and won't be tested.
For use cases 2 and 3 your code may produce incorrect output like this if not carefully implemented and hence they are out of scope. See the Booked seat in the middle section is overwritten by marker X.
[BB__ _BX__ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> s
[BB__ _B___ ____]
[____ __X__ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> a
[BB__ _B___ ____]
[____ _X___ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> a
[BB__ _B___ ____]
[____ X____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> w
[BB__ XB___ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
> d
[BB__ _X___ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
>
Preload Concerts
PreLoad Data for Concerts
When your program starts, you need to preload some data for concerts. You must add two concerts manually. The concert details are shown below - 
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             0              65             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             0              65             
---------------------------------------------------------------------------------------------------------------------------
Remember, the total seats are set by venue layout. 
For the prices for the seat, pre-load the prices as - 
For Concert 1
Left - 200
Middle - 500
Right - 250
For Concert 2
Left - 100
Middle - 300
Right - 150

Admin Menu
Addition: This specification is entirely new to Assignment 2.
For admin there are fairly simple tasks to perform like - 
admin can view the concerts (same as Option 1 of the customer menu)
admin can add a concerts
admin can remove a concert if no booking has been made for that concert
admin can view the costs of the seats for a concert (same as Option 2 of the customer menu)
admin can change the price of the seat sections
admin can look at the seat layouts with bookings (same as Option 3 of the customer menu)
If the user selects the Admin mode, you must print the below menu as output - 
Select an option to get started!
Press 1 to enter Customer mode
Press 2 to enter Admin mode
Press 3 to exit
> 2
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit

Option 1: 
Same as customer mode Option 1
Option 4: 
Same as customer mode Option 2
Option 6: 
Same as customer mode Option 3
Option 7: 
Same as customer mode but the message is changed to Exiting Admin mode. See output below - 
Select an option to get started!
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit
> 7
Exiting Admin Mode
Select an option to get started!
Press 1 to enter Customer mode
Press 2 to enter Admin mode
Press 3 to exit

Option 2: 
When the admin selects option 2 they should be able to add a concert. They must take all the details for the concert as inputs. Note that the total seats remain the same as the venue layout is set by command line parameters. And seats booked are set to 0 initially but are dynamically changed when the customer books a seat. See the program output below - 
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit
> 2
To add a new concert please enter the details:
Date: 2024-09-01
Timing: 1900-2100
Artist Name: Ed Shereen
Venue: MCG
Left zone price: 300
Middle zone price: 300.0
Right zone price: 300
New concert added successfully.
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit

You should show this concert added to the admin and customer if they choose option 1 now. Look at the output below - 
New concert added successfully.
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit
> 1
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             3              62             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             0              65             
3    2024-09-01     Ed Shereen     1900-2100      MCG                           65             0              65             
---------------------------------------------------------------------------------------------------------------------------
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit

Assumption: For options 3,4,5,6 whenever we need to select a concert to do a further action, the input for selecting the concert will always be correct i.e. in the above example either the concert selected would be 1,2, or 3 but never 4. 
Option 3:
Admin can remove a concert if no booking has been made for that concert. But if a booking is made already, then admin should not be able to remove the concert and an error must be shown. To remove a concert you must show all the concert details to the admin and ask which concert to remove. See the program output below.
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit
> 3
Select a concert that you want to remove.
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             0              65             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             0              65             
3    2023-07-01     Ed Shereen     1900-2100      MCG                           65             0              65             
---------------------------------------------------------------------------------------------------------------------------
> 3
Concert removed successfully.
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit
> 1
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             0              65             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             0              65             
---------------------------------------------------------------------------------------------------------------------------
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit

In case a booking is already made then you should show the error - Concert cannot be removed as tickets are booked for this concert.
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit
> 3
Select a concert that's price needs to be updated
Show Timings
---------------------------------------------------------------------------------------------------------------------------
#    Date           Artist Name    Timing         Venue Name                    Total Seats    Seats Booked   Seats Left     
---------------------------------------------------------------------------------------------------------------------------
1    2023-07-01     Taylor Swift   1700-1900      Melbourne Cricket Ground      65             0              65             
2    2023-07-02     Taylor Swift   1900-2100      Marvel Stadium                65             2              63             
---------------------------------------------------------------------------------------------------------------------------
> 2
Concert cannot be removed as tickets are booked for this concert.
Select an option to get started!
Press 1 to look at the concert timings
Press 2 to add a concert
Press 3 to remove a concert
Press 4 to look at the ticket costs
Press 5 to update the ticket costs for a concert
Press 6 to view the layout of the concert
Press 7 to exit

Option 5:
If the admin wants to update the price of seats for any concert using option 5, you must ask them to choose a concert and then ask them the prices of all three zones. Look at the output below 
Select an option to get started!
Press 1 to look at the concert timings
P

请加QQ:99515681  邮箱:99515681@qq.com   WX:codinghelp

责任编辑:code

相关阅读

Copyright © 安徽热线 All Rights Reserved.