//Answer to car class exercise.

#include <iostream>
using namespace std;

class cCar
{
public:
	cCar(void);
	cCar(int, float);
	void setColour(int);
	int getColour(void);
	void setFuel(float);
	float getFuel(void);

	void toot(void);
private:
	int colour;
	float fuel;
};

int main(void)
{
	cCar myCar(2, 55);//instantiate object of type class
	cCar otherCar;
	//myCar.setFuel(34);
	//myCar.setFuel(51.5);
	//myCar.setColour(2);
	cout << myCar.getFuel() << " Litres" << endl;
	cout << "Colour is " << myCar.getColour() << endl;
	myCar.toot();
	otherCar.toot();
	return 0;
}

//constructor
cCar::cCar(void)
{
	colour = 3; fuel = 50;
}
cCar::cCar(int c, float f)
{
	colour = 3; setFuel(50);
}

void cCar::setColour(int x)
{
	colour = x;
}

int cCar::getColour(void)
{
	return colour;
}

//set Fuel  - limit to 50L
void cCar::setFuel(float x)
{
	if (x > 50)
		fuel = 50;
	else
		fuel = x;
}

float cCar::getFuel(void)
{
	return fuel;
}


void cCar::toot(void)
{
	cout << "Toot!" << endl;
}