Car Class

Download Category:

CarClass.zip - (5.12 MB)
[
CarClass/CarClass.cpp
CarClass/CarClass.sdf
CarClass/CarClass.sln
CarClass/CarClass.suo
CarClass/CarClass.vcxproj
CarClass/CarClass.vcxproj.filters
CarClass/CarClass.vcxproj.user
CarClass/Debug/
CarClass/Debug/CarClass.exe
CarClass/Debug/CarClass.exe.embed.manifest
CarClass/Debug/CarClass.exe.embed.manifest.res
CarClass/Debug/CarClass.exe.intermediate.manifest
CarClass/Debug/CarClass.ilk
CarClass/Debug/CarClass.lastbuildstate
CarClass/Debug/CarClass.log
CarClass/Debug/CarClass.obj
CarClass/Debug/CarClass.pdb
CarClass/Debug/CarClass_manifest.rc
CarClass/Debug/cl.command.1.tlog
CarClass/Debug/CL.read.1.tlog
CarClass/Debug/CL.write.1.tlog
CarClass/Debug/link.4316.read.1.tlog
CarClass/Debug/link.4316.write.1.tlog
CarClass/Debug/link.4316-cvtres.read.1.tlog
CarClass/Debug/link.4316-cvtres.write.1.tlog
CarClass/Debug/link.command.1.tlog
CarClass/Debug/link.read.1.tlog
CarClass/Debug/link.write.1.tlog
CarClass/Debug/link-cvtres.read.1.tlog
CarClass/Debug/link-cvtres.write.1.tlog
CarClass/Debug/mt.command.1.tlog
CarClass/Debug/mt.read.1.tlog
CarClass/Debug/mt.write.1.tlog
CarClass/Debug/rc.command.1.tlog
CarClass/Debug/rc.read.1.tlog
CarClass/Debug/rc.write.1.tlog
CarClass/Debug/vc100.idb
CarClass/Debug/vc100.pdb
CarClass/ipch/
CarClass/ipch/carclass-7deb0b06/
CarClass/ipch/carclass-7deb0b06/carclass-d3be1a58.ipch
CarClass/Question.txt
CarClass/Screenshot.png
]

Implement a class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon or liters/km—pick one) and a certain amount of fuel in the gas tank. The efficiency is specified in the constructor, and the initial fuel level is 0. Supply a function drive that simulates driving the car for a certain distance, reducing the fuel level in the gas tank, and functions get_gas, to return the current fuel level, and add_gas, to tank up. Sample usage:

Car my_beemer(29); // 29 miles per gallon
my_beemer.add_gas(20); // Tank 20 gallons
my_beemer.drive(100); // Drive 100 miles
cout << my_beemer.get_gas() << "\n"; // Print fuel remaining

Write a Review

Get a fresh solution of this question. Ask it now to our experts.
doubt

Ask Your Question

We have verified professionals who are ready to answer your question.

time

Save Time and Money

We choose experts who can quickly answer your question and that suit your budget.

download

Get Your Answer

Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.