Question: 2- Write a program that determines the gas mileage of a car based on the miles travelled and gallons of gas consumed. (9 points) a.
2- Write a program that determines the gas mileage of a car based on the miles travelled and gallons of gas consumed. (9 points) a. First ask the user to enter the number of miles traveled and the number of gallons of gasoline consumed. b. Then calculate and display the miles-per-gallon value (MPG), showing one place to the right of the decimal. c. Next, using the fact that one gallon is about 3.785 liters and one mile is about 1.609 kilometers, convert the mile-per-gallon value to a liters-per-100-km value (L/100km), and display the result, showing two places to the right of the decimal. Note: The U.S. scheme measures the amount of fuel per distance, whereas the European scheme measures the distance per amount of fuel. d. Use symbolic constants (using #define) for the two conversion factors. The US government website should help in determining the actual MPGs for cars on the market: https://www.fueleconomy.gov/feg/findacar.shtml
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
