In CORAL LANGUAGE
In CORAL LANGUAGE please and thank you:
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.
Output the gas cost (gasCost) with two digits after the decimal point, which can be achieved as follows:
Put gasCost to output with 2 decimal places
Ex: If the input is:
20.0 3.1599
the output is:
1.58 7.90 63.20
Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. First use the dollars/gallon and miles/gallon values to calculate the dollars/mile. Then use the dollars/mile value to determine the cost per 10, 50, and 400 miles.
Note: Real per-mile cost would also include maintenance and depreciation.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
I put the program in but I'm being told it's wrong. It says expected output is 1.58 7.90 63.20
How can I get this output?