Question
Java Assignment for train system (Procedural Only) What i am trying to get is a menu driven system: Trip / Kiosk Purchase recording menu This
Java Assignment for train system (Procedural Only)
What i am trying to get is a menu driven system:
Trip / Kiosk Purchase recording menu
This data entry mechanism should be menu driven, with options for adding a trip and recording a kiosk purchase, as well as an exit option which allows the user to exit the menu and proceed with the final Trip invoice charge calculations.
The new code for this feature should be implemented after all customer information has been entered - note that the existing functionality for gathering trip information and calculating the trip fare will now need to be part of the first menu feature described below.
The menu itself should be case insensitive (i.e. it should accept both the upper and lower case versions of each valid menu selection) - this menu feature should also display a suitable error message when the user does not enter a valid selection from the menu.
The menu feature should also be implemented using a suitable loop so that the program can return back to the menu naturally after processing has been completed for the data entry option that was selected - this loop should only be exited if the user explicitly selects the Exit option from the menu.
Trip Recording Feature
The trip recording feature should function in the manner described in stage 1 / 2 above for input gathering and fare calculation, after which the program should proceed to assemble the details of the trip into a new trip list entry, which must be a single String containing the details of the trip: date, booking type, sectors travelled, basic fare, surcharge and adjusted fare in the format shown below:
Entry for scenario from mock execution run shown in Figure 4 from Stage 2:
- 01/03/2018 Reserved Seat - 7 sectors : fare: $13.30, surcharge: $2.66, total: $15.96
Entry for scenario from mock execution run shown in Figure 5 from Stage 2:
- 03/03/2018 First Class - 10 sectors : fare: $18.00, surcharge: $9.00, total: $27.00
Note: you may find the method String.format(), which works in a manner similar to printf() but returns the formatted output as String rather than displaying it on the screen, useful when assembling the new trip list entry.
This new trip list entry should then be appended to the trip list, which can either be a single String where new entries are concatenated onto the end of the existing trip list String (with a newline after each new entry), or stored in the next empty spot in an array.
Note: If you are using an array then you may assume that we will not enter details for more than 10 trips during testing.
The program should also add the adjusted trip fare that was calculated to a running trip fare total, which must be a single double variable.
Kiosk Purchase Recording Feature
The kiosk purchase recording feature should prompt the user to enter the date, description and cost of the kiosk purchase.
Once these details have been entered the program should assemble a new list entry as a single String, containing the details for the kiosk purchase: date, description and price, in the format shown below:
- 03/03/2018 - Ham Salad Sandwich : $9.00
Note: you may find the method String.format(), which works in a manner similar to printf() but returns the formatted output as String rather than displaying it on the screen, useful when assembling the new trip list entry.
This new kiosk purchase entry should then be appended to the purchase list, which can either be a single String where new entries are concatenated onto the end of the existing Purchase list String (with a newline after each new entry), or stored in the next empty spot in an array.
Note: If you are using an array then you may assume that we will not enter details for more than 10 trips during testing.
The program should also add the adjusted trip fare that was calculated to a running kiosk purchase total, which must be a single double variable.
Final Trip invoice charge Calculation
Once the user has selected the exit option from the menu the program should proceed to calculate the final Trip invoice charge as follows:
final invoice charge = trip fare total +
kiosk purchase total
Once all required processing and calculations have been completed the program should proceed to display updated invoice details which include the information shown in stage 1, as well as information in the trip and kiosk purchase lists and their corresponding totals.
A mock execution run for this stage has been provided below to give an indication of how the menu-driven feature should function and how the final invoice display should appear, but you are encouraged to test your program more thoroughly.
Thesed are the mock executions as listed:
Part 2 continue:
Any help would be great, especially on the last 2 sections.
Regional Passenger Train Data Entry Menu A - Record Trip B - Record Kiosk Purchase X - Exit Enter your selection: A Enter trip date: 03/03/2018 Enter start sector (1-10): 10 Enter end sector (1-10): 1 Enter booking type (s, RS or FC): FC Regional Passenger Train Data Entry Menu A Record Trip B - Record Kiosk Purchase X - Exit Enter your selection: x Customer Details: Name Email Address: Mobile Phone Number: Home Address: Ms Jil1 Smith jill.smith@myemail.com 0412 345 678 1 Smithton Way, Smith Valley, VIC Card details: Credit Card No: Expiry Date: 1234 5678 9012 3456 01/2019 Trip Details: fare: $5.00, surcharge: $0.00, total: - 26/02/2018 standard - 2 sectors $5.00 29/02/2018 standard 5 sectors fare: $9.50, surcharge: $0.0e, total: $9.50 01/03/2018 Reserved Seat - 7 sectors: fare: $13.30, surcharge: $2.66, total: $15.96 fare: $18.00, surcharge: $9.00, 03/03/2018 First Class - 10 sectors total: $27.00 Trip fare total: $57.46
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started