Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment description In this assignment, you will need to write programs that

ID: 3815513 • Letter: A

Question

Assignment description

In this assignment, you will need to write programs that help boat ride companies in Maine to sell boat ride tickets to tourists. Below please find the specifications:

Assume that each siteseeing boat has 8 rows, with 6 seats in each row. To represent the seats, the BoatRideManager class should have a two-dimensional array of String as the underline data structure (see the following UML); we use "O " (big oh with one empty space to its right) to reprent that a seat is available (or empty), and use "# " (hex with one empty space to its right) to represent it is already occupied (or sold). Meanwhile, to simplify the task, we assume that the ticket's price is $35.0 per person, no matter what is the passenger's age!

At the very beginning, a boat is always empty, i.e. all the 48 seats should be set to "O "(see the following), but after the program runs, some seats might be sold out and the seats become "# "

         Seats
      1 2 3 4 5 6
Row 1 O O O O O O
Row 2 O O O O O O
Row 3 O O O O O O
Row 4 O O O O O O
Row 5 O O O O O O
Row 6 O O O O O O
Row 7 O O O O O O
Row 8 O O O O O O

Legend: # = Sold
        O = Available

Each time when a customer try to purchase tickets, they can purchase up to 6 tickets, all in one row, if for example, they want to purchase >= 6 tickets, in two diffterent rows, they will need to do two transactions, i.e. purchase twice in each of the rows accordingly.

The driver program, namely Assignment7.java is a menu-driven programt that provides the user with a menu of boat ticket purchasing options, it also accepts and validates user inputs, and call appropriate class methods to carry out desired tasks. The menu has options to display the seating chart, request boat tickets, print a sales report and exit the program, etc.

1. Step #1: According to the following UML diagram, create a BoatRideManager class, save the souce code as BoatRideManager.java

Instance variables and methods' description

First, the purchaseTickets() method will call above checkAvailability() method to make sure the tickets request is valid. If the request is valid, it then prompt to ask user to enter money amount such as:

" Please input amount paid: $"

1. If the amount is sufficient, it will sell the tickets and do the following:  
- Mark these seats taken
- Call printTickets() to print the actual tickets
- Update the seatsSold and totalRevenue
- Display a purchase summary, such as the following one for the user:

Tickets purchased : 5
Payment           : $200.0
Total ticket price: $175.0
Change due        : $25.0

2. In case user entered insufficient amout of money, show the following message on screen:

" Insufficient payment.";
" The sale has been cancelled and your money is being returned. "

2. Step #2: You are given a partially finished driver prgroam called Assignment7.java, which has the main() method to create one new BoatRideManager objects called LuluBoatRide which will be used to check those methods in BoatRideManager.java class (see sample input & output files). //---- is where you need to fill in your own codes according to the instructions. The Assignment7.java will display the following menu to the user:

  Choose an Action
--------------------------
D: Display Seat Map
P: Purchase Boat Ride Tickets
S: Display Sales Report
?: Display the menu again
Q: Quit this program

The program will ask “Please enter a command: ”. A user will type in a character of their menu choice. Note: user might enter both upper case or lower case letters. Please find below for each command's description

BoatRideManager NUM_ROWS: int (final)
ROW_SIZE: int (final)
SEAT_PRICE: double (final)
-seatArray: String[][]
-seatsSold: int
-totalRevenue: double +BoatRideManager()
+displaySeats(): void
+checkAvailability(int, int, int): boolean
+purchaseTickets(int, int, int): void
+printTickets(int, int, int): void
+displaySalesReport(): void

Explanation / Answer

Answer:

Here is BoatRideManager.java:

----------------------------------------------------------------------------------------------------------------------------------

Here is Assignment7.java

-----------------------------------------------------------------------------------------------------------------------------------------------

OUTPUT:

Choose an Action
-----------------
D : Display Seat Map
P : Purchase Boat Ride Tickets
S : Display Sales Report
? : Display the menu again
Q : Quit this program
p
Enter the number of tickets required:
5
Enter the row number you want:
5
Enter the first seat number:
2

The seats you've requested are available for purchase.
The total purchase price will be: 5 seats X $35.0 = $175.0
Please input amount paid:$
200
******************************************************
           Lulu Lobster Boat Ride                  

       Row 5~Seat 2
       Row 5~Seat 3
       Row 5~Seat 4
       Row 5~Seat 5
       Row 5~Seat 6
       Row 5~Seat 7
******************************************************
Tickets purchased: 5
Payment: $200.0
Total Ticket Price: $175.0
Change due: $25.0
Choose an Action
-----------------
D : Display Seat Map
P : Purchase Boat Ride Tickets
S : Display Sales Report
? : Display the menu again
Q : Quit this program
d
       Seats          
   1 2 3 4 5 6  
Row 1 O O O O O O
Row 2 O O O O O O
Row 3 O O O O O O
Row 4 O O O O O O
Row 5 O # # # # #
Row 6 O O O O O O
Row 7 O O O O O O
Row 8 O O O O O O


Legend: # = Sold
       O = Available
Choose an Action
-----------------
D : Display Seat Map
P : Purchase Boat Ride Tickets
S : Display Sales Report
? : Display the menu again
Q : Quit this program
p
Enter the number of tickets required:
2
Enter the row number you want:
1
Enter the first seat number:
1

The seats you've requested are available for purchase.
The total purchase price will be: 2 seats X $35.0 = $70.0
Please input amount paid:$
70
******************************************************
           Lulu Lobster Boat Ride                  

       Row 1~Seat 1
       Row 1~Seat 2
       Row 1~Seat 3
******************************************************
Tickets purchased: 2
Payment: $70.0
Total Ticket Price: $70.0
Change due: $0.0
Choose an Action
-----------------
D : Display Seat Map
P : Purchase Boat Ride Tickets
S : Display Sales Report
? : Display the menu again
Q : Quit this program
d
       Seats          
   1 2 3 4 5 6  
Row 1 # # O O O O
Row 2 O O O O O O
Row 3 O O O O O O
Row 4 O O O O O O
Row 5 O # # # # #
Row 6 O O O O O O
Row 7 O O O O O O
Row 8 O O O O O O


Legend: # = Sold
       O = Available
Choose an Action
-----------------
D : Display Seat Map
P : Purchase Boat Ride Tickets
S : Display Sales Report
? : Display the menu again
Q : Quit this program
s
Lulu Lobster Boat Ride Sales Report
=======================================
Seats Sold:7
Seats Available:41
Total Revenue till date:$245.0
Choose an Action
-----------------
D : Display Seat Map
P : Purchase Boat Ride Tickets
S : Display Sales Report
? : Display the menu again
Q : Quit this program
?
Choose an Action
-----------------
D : Display Seat Map
P : Purchase Boat Ride Tickets
S : Display Sales Report
? : Display the menu again
Q : Quit this program
Q

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote