For an assignment for class i wrote this code right but the only problem i have is that i can't get the right value that assignment wants which is distance so far: 0 meters
distance so far: 1000 meters
distance so far: 0 meters
distance so far: 0 meters
distance so far: 2000 meters
distance so far: 0 meters
You can't start pedaling before you get on first!
You can't getOff before you getOn first!
ill post the code
#include <iostream>
using namespace std;
class Bike
{
public:
int getOn()
{return place;}
int pedal(int getDistance)
{return distance;}
int getOff()
{return place;}
int getDistance()
{return 0;}
private:
double distance;
int place;
int my_Distance;
bool my_someoneIsOn;
};
int main()
{
Bike( );
void getOn();
void pedal( int distance );
void getOff();
int getDistance();
int my_Distance;
bool my_someoneIsOn;
Bike b;
cout << "distance so far: ";
cout << b.getDistance( );
cout << endl;
b.getOn( );
b.pedal( 1000 );
cout << "distance so far: ";
cout << b.getDistance( );
cout << endl;
b.getOff( );
cout << "distance so far: ";
cout << b.getDistance( );
cout << endl;
b.getOn( );
cout << "distance so far: ";
cout << b.getDistance( );
cout << endl;
b.pedal( 2000 );
cout << "distance so far: ";
cout << b.getDistance( );
cout << endl;
b.getOff( );
cout << "distance so far: ";
cout << b.getDistance( );
cout << endl;
b.pedal( 500 );
b.getOff( );
return 0;
}