COP2002 Project 11-1: Arrival Time Estimator solution




5/5 - (4 votes)

Create a program that calculates the estimated hours and minutes for a trip. This
should include an estimated date/time of departure and an estimated date/time of arrival.
Arrival Time Estimator
Estimated date of departure (YYYY-MM-DD): 2018-11-23
Estimated time of departure (HH:MM AM/PM): 10:30 AM
Enter miles: 200
Enter miles per hour: 65
Estimated travel time
Hours: 3
Minutes: 4.62
Estimated date of arrival: 2018-11-23
Estimated time of arrival: 01:34 PM
Continue? (y/n): y
Estimated date of departure (YYYY-MM-DD): 2018-11-29
Estimated time of departure (HH:MM AM/PM): 11:15 PM
Enter miles: 500
Enter miles per hour: 80
Estimated travel time
Hours: 6
Minutes: 15.0
Estimated date of arrival: 2018-11-30
Estimated time of arrival: 05:30 AM
Continue? (y/n): n
• For the date/time of departure and arrival, the program should use the YYYY-MM-DD format for
dates and the HH:MM AM/PM format for times.
• For the miles and miles per hour, the program should only accept integer entries like 200 and 65.
• Assume that the user will enter valid data.
• Save the file with the filename where XXX is either your initials or your last name.
Bonus: +25 points
• If you add the following to your program, your grade on this program can be as high as 125%. This
will help your overall Homework average!
• Add validation (error checking) and exception handling for all user entries. In other words, do not
assume the user will enter valid data.
• If you do this part, let me know (in the Comment area of the Drop Box) that I can enter invalid data
and the program will not crash.