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

The picture above is how your output 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.

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

Implementing Ai And Machine Learning For Business Optimization

Authors: Robert K Wiley

1st Edition

B0CPQJW72N, 979-8870675855

More Books

Students also viewed these Databases questions