Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles,

Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles.

Ex: If the input is:

20.0 3.1599 

Then the output is:

1.579950 7.899750 63.198000 

Note: To solve the problem, calculate first the gas cost for driving a mile. Then use this result to compute the gas cost for 10 miles, 50 miles, and 400 miles.

Note: Real per-mile cost would also include maintenance and depreciation.

Note: Output appears on one line

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

More Books

Students also viewed these Databases questions

Question

Define Administration?

Answered: 1 week ago