Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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-150km
2-450km
3-900km
Your 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

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

Step: 3

blur-text-image

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

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions

Question

Develop clear policy statements.

Answered: 1 week ago

Question

Draft a business plan.

Answered: 1 week ago

Question

Describe the guidelines for appropriate use of the direct plan.

Answered: 1 week ago