0% found this document useful (0 votes)
10 views

Assignment 8

Uploaded by

seif798mostafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Assignment 8

Uploaded by

seif798mostafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

//Assignment 8

//-Q1-
//#include <iostream>
//using namespace std;
//class Animal {
// string name;
//public:
// Animal() {
//
// }
// Animal(string name) {
// this->name = name;
// }
// virtual void greets() = 0;
//};
//class Cat : public Animal {
//public:
// Cat() {
//
// }
// Cat(string n) : Animal(n) {
//
// }
// void greets() override {
// cout << "Meow"<<endl;
// }
//};
//class Dog : public Animal {
//public:
// Dog() {
//
// }
// Dog(string n) : Animal(n) {
//
// }
// void greets() override {
// cout << "Woof"<<endl;
// }
// void greets(Dog another) {
// cout << "Woooof"<<endl;
// }
//};
//class BigDog : public Dog {
//public:
// BigDog() {
//
// }
// BigDog(string n) : Dog(n) {
//
// }
// void greets() override {
// cout << "Wooow"<<endl;
// }
// void greets(Dog another) {
// cout << "Woooooow"<<endl;
// }
// void greets(BigDog another) {
// cout << "Wooooooooow"<<endl;
// }
//};
//int main() {
// Dog dog;
// Cat cat;
// BigDog bigdog;
// dog.greets();
// dog.greets(dog);
// cat.greets();
// bigdog.greets();
// bigdog.greets(bigdog);
// bigdog.greets(dog);
//}
//=============================
//-Q2-
//#include <iostream>
//using namespace std;
//class Vehicle {
//protected:
// string VehicleModel;
// string RegistrationNumber;
// int VehicleSpeed;
// double FuelCapacity;
// double FuelConsumption;
//public:
// Vehicle(){
//
// }
// Vehicle(string VehicleModel, string RegistrationNumber, int VehicleSpeed,
double FuelCapacity, double FuelConsumption) {
// this->VehicleModel = VehicleModel;
// this->RegistrationNumber = RegistrationNumber;
// this->VehicleSpeed = VehicleSpeed;
// this->FuelCapacity = FuelCapacity;
// this->FuelConsumption = FuelConsumption;
// }
// void setVehicleModel(string VehicleModel) {
// this->VehicleModel = VehicleModel;
// }
// string getVehicleModel() {
// return VehicleModel;
// }
// void setRegistrationNumber(string RegistrationNumber) {
// this->RegistrationNumber = RegistrationNumber;
// }
// string getRegistrationNumber() {
// return RegistrationNumber;
// }
// void setVehicleSpeed(int VehicleSpeed) {
// this->VehicleSpeed = VehicleSpeed;
// }
// int getVehicleSpeed() {
// return VehicleSpeed;
// }
// void setFuelCapacity(double FuelCapacity) {
// this->FuelCapacity = FuelCapacity;
// }
// double getFuelCapacity() {
// return FuelCapacity;
// }
// void setFuelConsumption(double FuelConsumption) {
// this->FuelConsumption = FuelConsumption;
// }
// double getFuelConsumption() {
// return FuelConsumption;
// }
// void display() {
// cout << "Vehicle model: " << VehicleModel << endl;
// cout << "Registration number: " << RegistrationNumber << endl;
// cout << "Vehicle speed: " << VehicleSpeed << endl;
// cout << "Fuel capacity: " << FuelCapacity << endl;
// cout << "Fuel consumption: " << FuelConsumption << endl;
// }
//};
//class Truck : public Vehicle {
// double CargoWeight;
//public:
// Truck() {
//
// }
// Truck(string VehMod, string RegNum, int VehSped, double FulCap, double
FulConsum , double CargoWeight) : Vehicle(VehMod , RegNum, VehSped , FulCap ,
FulConsum) {
// this->CargoWeight = CargoWeight;
// }
//
// void setCargoWeight(double CargoWeight) {
// this->CargoWeight = CargoWeight;
// }
// double getCargoWeight() {
// return CargoWeight;
// }
// void display() {
// Vehicle::display();
// cout << "Cargo weight: " << CargoWeight << endl<<endl;
// }
//};
//class Bus : public Vehicle {
// int NumberOfPassengers;
//public:
// Bus(){
//
// }
// Bus(string VehMod, string RegNum, int VehSped, double FulCap, double
FulConsum, int NumberOfPassengers) : Vehicle(VehMod, RegNum, VehSped, FulCap,
FulConsum) {
// this->NumberOfPassengers = NumberOfPassengers;
// }
// void setNumberOfPassengers(int NumberOfPassengers) {
// this->NumberOfPassengers = NumberOfPassengers;
// }
// int getNumberOfPassengers() {
// return NumberOfPassengers;
// }
// void display() {
// Vehicle::display();
// cout << "Number of passengers: " << NumberOfPassengers << endl<<endl;
// }
//};
//
//int main() {
// Truck T1("Hunday","53622",150,50.7,24.9,300.68);
// Bus B1("BMW","73736",180,60.5,30,60);
// T1.display();
// B1.display();
//}

You might also like