Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please create a c++ program that fulfills all requirements listed below. You are going to write an Odometer class that will track fuel and mileage

Please create a c++ program that fulfills all requirements listed below. image text in transcribed
You are going to write an Odometer class that will track fuel and mileage for an automotive vehicle The class should have member variables to track the miles driven (odometer reading), the fuel efficiency of the vehicle in miles per gallon, and the number of gallons used. Include a function to reset the number of miles driven to 0. This should also reset the other variables. You should have a constructor that accepts the miles driven for a trip and number of gallons used. This function should add the miles to the miles driven and the gallons to the gallons used. It should calculate the fuel efficiency. You should have accessor functions to return the odometer reading, fuel efficiency, and gallons used since the odometer was last reset. There should be a function that will accept the number of miles to drive and return the number of gallons of gas needed based on the fuel efficiency to drive that number of miles. You are to write test code to make sure that your Odometer class works. You need to test at least 3 cases. This means you must use at least 3 Odometers and make sure they each work correctly All of your functions in the Odometer class must be tested to show that they work. Testing the Odometer class is very open ended. This means that the proof of it working depends on you to make sure that in main you have tested all possibilities. The input and output is your responsibility to demonstrate a working cla ss. Class member variables-all should be able to hold decimal numbers: number of miles driven number of gallons used fuel efficiency Class member functions Default constructor Constructor that will accept miles driven and gallons Reset-resets miles and gallons to 0 Accessor functions for each of the data Given a number of miles driven, return the amount of fuel that will be needed based on the fuel efficiency Requirements Odometer must be implemented in a class with the above requirements. .No global variables are to be used

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

Question

Show the properties and structure of allotropes of carbon.

Answered: 1 week ago