#include <iostream>
using namespace std;
class Person
{
private:
string name;
public:
Person();
Person(string the_name);
string get_name() const;
};
////////////////////////////////////////////////////////////////
class vehicle
{
protected:
string name;
int cylinders;
Person owner;
public:
vehicle();
vehicle(string _name, int _cylinders, Person _owner);
void display()
{
cout << name;
cout << cylinders;
cout << owner.get_name();
}
};
/////////////////////////////////////////////////////////////
class truck: private vehicle
{
protected:
double tons;
int towCap;
public:
truck();
truck(string _name, double _tons, int _towCap, int _cylinders, Person _owner);
void display();
bool setTons(double _tons);
bool setTC(int _towCap);
bool setC(int _cylinders);
bool setName(string _name);
bool setPerson(Person _owner);
};
////////////////////////////////////////
truck::truck()
{
_name = "Toyota";
_tons = 0;
_towCap = 0;
_cylinders = 0;
_owner = "Nick";
}
///////////////////////////////////////
//truck::truck(string _name, double _tons, int _towCap, int _cylinders, Person _owner)
///////////////////////////////////////
void truck::display()
{
/*cout << setTons(_tons);
cout << setTC(_towCap);
cout << setName(_name);
cout << setPerson(_owner);*/
}
//////////////////////////////////////
bool truck::setTons(double _tons)
{
if(_tons < 10)
{
_tons = 0;
return false;
}
else
{
tons = _tons;
return true;
}
}
////////////////////////////////////////
bool truck::setTC(int _towCap)
{
if(_towCap < 100000)
{
_towCap = 0;
return false;
}
else
{
towCap = _towCap;
return true;
}
}
/////////////////////////////////////////
bool setC(int _cylinders)
{
if(_cylinders < 0)
{
_cylinders = 0;
return false;
}
else
{
cylinders = _cylinders;
return true;
}
////////////////////////////////////////
bool truck::setName(string _name)
{
name = _name;
return true;
}
/////////////////////////////////////////
bool truck::setPerson(Person _owner)
{
owner = _owner;
return true;
}
}
here is my code...i have some errors and cant seem to fix them...can someone help me