Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a program that calculates the estimated duration of a trip in hours and minutes. This should include an estimated date/time of departure and an

Create a program that calculates the estimated duration of a trip in hours and minutes. This should include an estimated date/time of departure and an estimated date/time of arrival.

Python

Arrival Time Estimator

Enter date of departure (YYYY-MM-DD): 2020-11-23 Enter time of departure (HH:MM AM/PM): 10:30 PM Enter miles: 480

Enter miles per hour: 75

Estimated travel time Hours: 6

Minutes: 24

Estimated date of arrival: 2020-11-24 Estimated time of arrival: 04:54 AM

Continue? (y/n): y

Enter date of departure (YYYY-MM-DD): 2020-12-01 Enter time of departure (HH:MM AM/PM): 11:00 AM Enter miles: 500

Enter miles per hour: 80

Estimated travel time Hours: 6

Minutes: 15

Estimated date of arrival: 2020-12-01 Estimated time of arrival: 05:15 PM

Continue? (y/n): n Bye!

Console

Specifications

  • 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.
  • Create a single data/time string variable based on the two input variables. Use this combined string variable to create a departure date-time object that will be used to determine the estimated arrival date and time.
  • For the miles and miles per hour, the program should only accept integer entries, such as 200 for miles or 65 for mph.
  • Calculate the hours travelled based on the integer division of miles divided by mph. The minutes are based on the remainder of miles divided by mph. The remainder must then be converted to minutes based on the mph. Use the hours and minutes to create a time delta object.
  • Assume that the user will enter valid data.

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions