Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use the following information to calculate the public transport costs: Distance Adult Opal fare (peak times) 0+ to 10 km $3.61 10+ to 20 km
Use the following information to calculate the public transport costs: Distance Adult Opal fare (peak times) 0+ to 10 km $3.61 10+ to 20 km $4.48 20+ to 35 km $5.15 35+ to 65 km $6.89 65+ km $8.86 Customers receive a 30% discount when travelling outside the peak times. The peak times are 6:30 AM to 10 AM and 3 PM to 7 PM, Monday to Friday. In addition, there are cap limits so that customers will not pay more than $16.10 on a weekday or $8.05 on Saturday and Sunday. You are required to design and write an interactive program that prompts the user for the travel day and the number of trips. For each trip, the program will prompt the user for the trip start time, trip end time and trip distance. The program should then print the fare for each trip and the total fare, according to the rules described above. Notes: The peak-time rate is decided based on the start time of the trip, regardless of the end time. The fare for each trip is calculated separately. That is, two separate trips of 5 km each within peak times will cost $3.61 + $3.61 = $7.22. You are not required to consider transfers or continuous journeys. Review the sample run below to clearly understand all requirements. Review the sample run below to clearly understand all requirements. Transport Fare Calculator ================================= Enter the travel day: Monday Enter the number of trips: 4 Enter trip (1) start time (HHMM) : 0700 Enter trip (1) end time (HHMM) : 0730 Enter trip (1) distance: 15 Trip (1): 15 km, peak: $4.48 Enter trip (2) start time (HHMM) : 1030 Enter trip (2) end time (HHMM) : 1130 Enter trip (2) distance: 18 -- Trip (2): 18 km, off peak: $3.14 Enter trip (3) start time (HHMM) : 1500 Enter trip (3) end time (HHMM) : 1630 Enter trip (3) distance: 22 -- Trip (3): 22 km, peak: $5.15 Enter trip (4) start time (HHMM): 2000 Enter trip (4) end time (HHMM) : 2200 Enter trip (4) distance: 41 -- Trip (4): 41 km, off peak: $4.82 Fare summary: Subtotal: $17.59 Daily cap reached. Total fare: $16.10 Have & nice day! Constraints 1. You must use a loop when prompting the user for trip details. 2. You must use string formatting when displaying the fare details. Constraints 1. You must use a loop when prompting the user for trip details. 2. You must use string formatting when displaying the fare details. Task 1 (3 marks) Draw a flowchart that presents the steps of the algorithm required to perform the task specified. It is recommended to use Draw.io to draw your flowchart. Task 2 (12 marks) Implement your algorithm in Python. Comment on your code as necessary to explain it clearly. Task 3 (5 marks) Select at least three sets of test data that will demonstrate the normal operation of your program; that is, test data that will demonstrate what happens when a valid input is entered. Select at least two sets of test data that will demonstrate the abnormal operation of your program; that is, test data that will demonstrate what happens when an invalid input is entered. used. It is important that the output Set it out in a tabular form as follows: test data type, test data, the reason it was selected, the output expected due to using the test data, and finally a screenshot of the output actually observed when the test data listings (i.e., screenshots) are not edited in any way. Data type Test data Reason it was selected Expected output Screenshot of actual output Normal Normal Normal Abnormal Abnormal Run your program using the test data you have selected and complete the last column of test data table above. Use the following information to calculate the public transport costs: Distance Adult Opal fare (peak times) 0+ to 10 km $3.61 10+ to 20 km $4.48 20+ to 35 km $5.15 35+ to 65 km $6.89 65+ km $8.86 Customers receive a 30% discount when travelling outside the peak times. The peak times are 6:30 AM to 10 AM and 3 PM to 7 PM, Monday to Friday. In addition, there are cap limits so that customers will not pay more than $16.10 on a weekday or $8.05 on Saturday and Sunday. You are required to design and write an interactive program that prompts the user for the travel day and the number of trips. For each trip, the program will prompt the user for the trip start time, trip end time and trip distance. The program should then print the fare for each trip and the total fare, according to the rules described above. Notes: The peak-time rate is decided based on the start time of the trip, regardless of the end time. The fare for each trip is calculated separately. That is, two separate trips of 5 km each within peak times will cost $3.61 + $3.61 = $7.22. You are not required to consider transfers or continuous journeys. Review the sample run below to clearly understand all requirements. Review the sample run below to clearly understand all requirements. Transport Fare Calculator ================================= Enter the travel day: Monday Enter the number of trips: 4 Enter trip (1) start time (HHMM) : 0700 Enter trip (1) end time (HHMM) : 0730 Enter trip (1) distance: 15 Trip (1): 15 km, peak: $4.48 Enter trip (2) start time (HHMM) : 1030 Enter trip (2) end time (HHMM) : 1130 Enter trip (2) distance: 18 -- Trip (2): 18 km, off peak: $3.14 Enter trip (3) start time (HHMM) : 1500 Enter trip (3) end time (HHMM) : 1630 Enter trip (3) distance: 22 -- Trip (3): 22 km, peak: $5.15 Enter trip (4) start time (HHMM): 2000 Enter trip (4) end time (HHMM) : 2200 Enter trip (4) distance: 41 -- Trip (4): 41 km, off peak: $4.82 Fare summary: Subtotal: $17.59 Daily cap reached. Total fare: $16.10 Have & nice day! Constraints 1. You must use a loop when prompting the user for trip details. 2. You must use string formatting when displaying the fare details. Constraints 1. You must use a loop when prompting the user for trip details. 2. You must use string formatting when displaying the fare details. Task 1 (3 marks) Draw a flowchart that presents the steps of the algorithm required to perform the task specified. It is recommended to use Draw.io to draw your flowchart. Task 2 (12 marks) Implement your algorithm in Python. Comment on your code as necessary to explain it clearly. Task 3 (5 marks) Select at least three sets of test data that will demonstrate the normal operation of your program; that is, test data that will demonstrate what happens when a valid input is entered. Select at least two sets of test data that will demonstrate the abnormal operation of your program; that is, test data that will demonstrate what happens when an invalid input is entered. used. It is important that the output Set it out in a tabular form as follows: test data type, test data, the reason it was selected, the output expected due to using the test data, and finally a screenshot of the output actually observed when the test data listings (i.e., screenshots) are not edited in any way. Data type Test data Reason it was selected Expected output Screenshot of actual output Normal Normal Normal Abnormal Abnormal Run your program using the test data you have selected and complete the last column of test data table above
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