Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Boat Ticket Reservation System in Java Requirements for Boat Ticket Reservation System Origin is Boat Harbor N Total of three different trips for Boat Harbor

Boat Ticket Reservation System in Java

Requirements for Boat Ticket Reservation System

  • Origin is Boat Harbor N

  • Total of three different trips for Boat Harbor N **( Boat Harbor N to Boat Harbor A, Boat Harbor N to Boat Harbor B, and Boat Harbor N to Boat Harbor C)

  • Each trip is an object of a class (3 objects Trip to Harbor A, Trip to Harbor B, Trip to Harbor C within one class)

  • Within this class, it should have an origin and destination coded with strings, a boat ticket number that is determined through a static instance variable, the capacity and the number of booked passengers using integers and the fare using real value function.

There are 3 parts to the program

  1. Information on the three boat trips. (Included as a method within the client program)

  2. The code should output the flight information

  3. Ask the user if they would like to buy boat tickets

  • When the answer is yes proceed to ask the user for the destination of the boat ride **(If there are no boat trips with the destination print the message No Boat Trips Available for that Destination)

  • Ask how many tickets will be bought. Use a boolean function within a method to determine if there is room. If there is room use a separate method to determine the fare using a real value function.

  • Continue to ask the user if it would like to buy boat tickets until the answer is No

*Key components of the code

  • Proper Response when no trips are available for a destination

  • Proper Response for enough tickets

  • Only allow the user to make purchases on one trip

  • Allow the user to purchase more than one ticket on the same trip

Information for Trip 1

Origin: Boat Harbor N

Destination: Boat Harbor A

Current Booked Tickets: 180

Capacity: 200

Ticket Price for 1 Person: 10$

Information for Trip 2

Origin: Boat Harbor N

Destination: Boat Harbor B

Current Booked Tickets: 200

Capacity: 300

Ticket Price for 1 Person: 20$

Information for Trip 3

Origin: Boat Harbor N

Destination: Boat Harbor C

Current Booked Tickets: 300

Capacity 400

Ticket Price for 1 Person: 30$

Example:

The code should show information for all 3 boat trips (Origin, Destination, Capacity, Number of Booked Seats, and Ticket Price as well as Boat Number)

As the user, I would like to the boat trip from Boat Harbor N to Boat Harbor A and I would like to purchase 5 tickets

The user will be told that there are available seats and the price of the tickets are

After the purchase, the information of available seats would be updated

If the user attempts to purchase a number of tickets that exceeds the number of available seats the code will print the message Not enough available seats

The code should be simple and use global variables as well as local variables.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What are the purposes of promotion ?

Answered: 1 week ago