Question: In python Assuming there are no accidents or delays, the distance a car travels down the interstatecan be calculated with the following formula:Distance = speed

In python
Assuming there are no accidents or delays, the distance a car travels down the interstatecan be calculated with the following formula:Distance = speed x timeWhile the length of a trip would be calculated byTime = distance/speedIn addition, lets assume the following are true:-For every 2 hours of travelling, speeding cars can get a ticket depending on howfast they are going. If they travel more than 100km per hour the ticket is $200, while if theytravel more than 120km per hour it costs $800.-Every hour of travelling consumes, on average, 20 liters of gas for your make andmodel of car.-Gas currently costs $3.12 per literWrite a simple program that takes as input, the speed you plan to travel (no need to input the distance) and then outputs how long and how expensive it will be to travel thefollowing constant distances:1.150km2.450km3.900kmYour solution must also do the following: Validate these the user input (speed) meets some logical criteria that you decide.(hint: can you travel negative KM/hour?) Still meet all expectations for style, comments and clarity in code. Use constants where appropriate. Provide a descriptive user experience (e.g. if something goes wrong, the usershould be told what they did wrong so they can fix it in the future).To help you succeed, a car travelling 80 KM/hour would expect to produce the followingoutputs:1.150km 1.875 hours for a cost of 117(no tickets)2.450km 5.625 hours for a cost of 351(no tickets)3.900km -11.25 hours for a cost of 702(no tickets)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!