Need help with C++ work

In your program, define a class called Tracker that will track fuel and mileage for a jet. The class should have member variables to track the miles flown and the fuel efficiency of the jet in miles per gallon. Include a mutator function to reset the meter to zero miles, a mutator function to set the fuel efficiency, a mutator function that accepts miles flown for a trip and adds it to the meter's total, and an accessor function that returns the number of gallons of gas that the vehicle has consumed since the meter was last reset.
Your program should prompt the user to enter how many trips they wish to enter.
Then your program will ask for the total number of miles traveled in each trip and the number of gallons of fuel used for each trip. Your program will calculate the fuel efficiency of each trip, the total miles covered for all trips, the total amount of fuel used for all trips and the fuel efficiency for all trips averaged together. When your program has read in all the trip information, your program will prompt the user with a menu with these options until the user exits or enters A) to enter in a new set of trips:

A) enter new set of trips [this repeats the above interaction]
B) output fuel used [outputs each trip's fuel usage and total for all trips]
C) output miles flown [outputs each trip's mileage and total for all trips]
D) output all trips fuel efficiencies [outputs each trip's fuel efficiency as well as average overall]
E) exit

ALGORITHM: you must include an algorithm at the top of your program which is a 'recipe' for how you will approach the problems of the program to make them work properly in code

Here is what i have so far but i t will not compile.Were are my errors?

#include <iostream>
#include <iomanip>
using namespace std;

class tracker
{
public:
void input ( );
void efficiency ( );
void set (int newtrips, double newmiles, double newgas);
void set (double miles, double gas);
void set (int changemiles);
double getgas( );
double getmiles( );
double efficiency;
private:
int trips;
double miles, gas;
};
int main ()
{
int x;
tracker meter;
meter.input ( );
cout << "What would you like to do?" << endl;
cout << "1. Enter a new set of trips, mileage and gas usage" << endl;
cout << "2. Output fuel used" << endl;
cout << "3. Output mileage" << endl;
cout << "4. Output fuel efficiency" << endl;
cout << "5. Exit" << endl;
cout << "Your choice: ";
cin >> x;
switch (x)
{
case 1:
meter.input ( );
case 2:
meter.getgas( );
case 3:
meter.getmiles( );
case 4:
meter.efficiency ( );
}
void tracker:input ( )
{
cout << "How many trips do you wish to make? ";
cin >> trips;
cout << "How many miles in total ae you driving? ";
cin >> miles;
cout << "How many gallons of gas are used? ";
cin >> gas;
}
void tracker:efficiency ( )
{
efficiency = miles/gas;
return efficiency;
}
void tracker:set(int newtrips, double newmiles, double newgas)
{
cout << "How many trips do you wish to make? ";
cin >> trips;
cout << "How many miles in total ae you driving? ";
cin >> miles;
cout << "How many gallons of gas are used? ";
cin >> gas;
}
double tracker:getgas()
{
return gas;
}
double tracker:getmiles()
{
return miles;
}
Last edited on
Please use code tags.

your compiler should show you the conflicts.
Topic archived. No new replies allowed.