I'm VERY new at C++, and I have to write an application program that utilizes a car object. The void start should be called at the beginning to set private data items for the car constructor. The values set should be input from the user. The rest of the program should be menu driven with choices for driving a trip, adding gas, printing the car information, and quitting. The main program should prompt the user for the amount of gas and the distance of the trip when those choices are selected.
So far, I've only been able to write the header file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
class car
{
private:
int mileage;
double gas;
double mpg;
double tank_size;
public:
car ();
void start (double m, double ts);
void add_gas (double g);
void drive (int m);
void print ();
};
thats the header code, but now I dont know how I should start writing the actual source code. So far, I only have
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// Main program that uses the Car class
#include <cstdlib>
#include <iostream>
usingnamespace std;
#include "car.h"
int main(int argc, char *argv[])
{
return 0;
}
Does anyone have any tips or suggestions? I wrote a hockey program that's kind of similar if anyone can show me what steps to take from that code and how to do this one would be great.