Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using (VS17Express) Write a C++ program to evaluate the fuel consumption of a car. The mileage at the start and end of the journey should

Using (VS17Express)

Write a C++ program to evaluate the fuel consumption of a car.

The mileage at the start and end of the journey should be read, and also the fuel level in the tank at the start and end of the journey.

Calculate fuel used, miles travelled, and hence the overall fuel consumption in miles travelled per gallon of fuel.

In many countries using the metric system, car fuel consumptions are measured in liters of fuel required to travel 100 kilometers.

Modify your solution so that the output now specifies the distance travelled in kilometers as well as in miles, and the fuel consumed in liters as well as in gallons, and the consumption in liters per 100 kilometers as well as in miles per gallon.

Use const for the conversion factors between miles and kilometers, and gallons and liters.

Design:

Your output should be formatted to 2 decimal places.

1mile = 1.609kms

1gallon = 3.785liters

image text in transcribed

The picture above is how it should look.

Your program should ask the questions in the same order. Starting mileage first, ending mileage, fuel at start, and fuel at end.

It's not specified how/if/when you should round your answers. It's only specified that your output should be formatted to two decimal places.

Document your assumption as comments in your code. Thank you.

Enter starting mileage: 12000 Enter ending mileage: 12453 Enter fuel at start in gallons: 23 Enter fuel at end in gallons: 3.5 Number of miles travelled 453.00 miles Fuel used19.50 gallons Miles per gallon of fuel 23.23 Number of kms travelled 728.88 kms Fuel used73.81 liters Liters per 100 kms 10.13 Press any key to continue

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

Algorithmic Trading Navigating The Digital Frontier

Authors: Alex Thompson

1st Edition

B0CHXR6CXX, 979-8223284987

More Books

Students also viewed these Databases questions

Question

How do we know there is such a thing as the strong nuclear force?

Answered: 1 week ago

Question

address the healthcare managers role in relation to each.

Answered: 1 week ago