Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
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

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

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions