Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Car.h"
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- Car::Car( string model, string licence,int velocity)
- {
- this->model=model;
- this->licence=licence;
- this->velocity=0;
- }
- Car::Car()
- {
- this->model="Unknown";
- this->licence="Unknown";
- }
- string Car::getModel()
- {
- return this->model;
- }
- string Car::getLicence()
- {
- return this->licence;
- }
- int Car::getVelocity()
- {
- return this->velocity;
- }
- bool Car::CarInMotion()
- {
- if(this->velocity!=0)
- return true;
- else
- return false;
- }
- bool Car::winner(int V)
- {
- if(this->velocity>=V)
- return true;
- else
- return false;
- }
- void Car::present()
- {
- cout<<this->model<<" "<<this->licence<<" "<<this->velocity<<"km/h."<<endl;
- }
- void Car::acceleration()
- {
- this->velocity+=rand()%10+1;
- }
- void Car::retardation()
- {
- this->velocity-=rand()%1+5;
- }
- void Car::setVelocity(int velocity)
- {
- this->velocity=velocity;
- }
- void Car::setModel(string model)
- {
- this->model=model;
- }
- void Car::setLicence(string licence)
- {
- this->licence=licence;
- }
Advertisement
Add Comment
Please, Sign In to add comment