0% found this document useful (0 votes)
2 views3 pages

Shafi Project

The document is a C++ program that defines several classes related to vehicle management, including vehicle details, owner information, maintenance logs, traffic violations, insurance details, and performance metrics. It also includes an admin class that can update vehicle information. The main function provides a menu-driven interface to display or update these details based on user input.

Uploaded by

soomrozain559
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)
2 views3 pages

Shafi Project

The document is a C++ program that defines several classes related to vehicle management, including vehicle details, owner information, maintenance logs, traffic violations, insurance details, and performance metrics. It also includes an admin class that can update vehicle information. The main function provides a menu-driven interface to display or update these details based on user input.

Uploaded by

soomrozain559
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/ 3

#include <iostream>

#include <string>
using namespace std;

class adminShafi;
class vehicleShafi {
private:
int registerationNumber;
protected:
string model;
public:
vehicleShafi() {
registerationNumber = 97;
model = "Civic";
}
void displayVehicle() {
cout << "Registeration Number: " << registerationNumber << endl;
cout << "Vehicle Model: " << model << endl;
}
friend class adminShafi;
};
class ownerDetailShafi : public vehicleShafi {
protected:
string ownerName;
string contactInfo;
public:
ownerDetailShafi() {
ownerName = "Shafi Ullah";
contactInfo = "0321 1234567";

}
void displayOwnerDetail() {
cout << "Owner Name: " << ownerName << endl;
cout << "Contact Information: " << contactInfo << endl;
}
};

class maintainenceLogShafi : public ownerDetailShafi {


public:
string maintainenceRecord;
maintainenceLogShafi() {
maintainenceRecord = "Working";

}
void displaymaintainenceLogDetail() {
cout << "Maintainence Record: " << maintainenceRecord << endl;
}
};

class trafficViolationRecordShafi : public vehicleShafi {


protected:
int ticketIssued;
public:
string violationDetails;
trafficViolationRecordShafi() {
ticketIssued = 2;
violationDetails = "1. Parking ticket\n2. Speeding Ticket";

}
void displayTrafficViolationRecord() {
cout << "Tickets Issued: " << ticketIssued<< endl;
cout << "Violation details: " << violationDetails << endl;
}
};

class insuranceDetailsShafi {
protected:
string insuranceCompany;
int policyNumber;
public:

insuranceDetailsShafi() {
insuranceCompany = "Habib insurance";
policyNumber = 123789;

}
void displayInsuranceDetail() {
cout << "Insurance Company: " << insuranceCompany << endl;
cout << "Policy Number: " << policyNumber << endl;
}
};

class performanceMetricsShafi: public maintainenceLogShafi {


protected:
string engineHealth;
public:
string fuelEfficiency;

performanceMetricsShafi() {
engineHealth = "Fair";
fuelEfficiency = "12 L/kl";

}
void displayPerformanceMetrics() {
cout << "Engine Health: " << engineHealth << endl;
cout << "Fuel Effiecieny " << fuelEfficiency<< endl;
}
};

class adminShafi{
private:
int adminID;

public:
adminShafi(){
adminID = 112;
}
void updateVehicleInfo(vehicleShafi& obj) {
cout << "Admin ID: " << adminID << endl;
obj.registerationNumber = 798;
cout << "Updated Vehicle Registeration Number: " <<
obj.registerationNumber << endl;
}

};
int main() {
vehicleShafi v;
ownerDetailShafi o;
maintainenceLogShafi m;
trafficViolationRecordShafi t;
insuranceDetailsShafi i;
performanceMetricsShafi p;
adminShafi a;

int choice;
do {
cout << "\n\nEnter Choice\n1. Vehicle Details\n2. Owner Details\n3.
Maintainence Log\n4. Traffic Violations\n5. Insurance Details\n6. Performance
Metrics\n7. Admin\n0. Exit" << endl;
cin >> choice;
switch (choice) {
case 1: cout << "\n===VEHICLE DETAILS===" << endl; v.displayVehicle();
break;
case 2: cout << "\n===OWNER DETAILS===" << endl;
o.displayOwnerDetail(); break;
case 3: cout << "\n===MAINTAINENCE LOG===" << endl;
m.displaymaintainenceLogDetail(); break;
case 4: cout << "\n===TRAFFIC VIOLATION===" << endl;
t.displayTrafficViolationRecord(); break;
case 5: cout << "\n===INSURANCE DETAILS===" << endl;
i.displayInsuranceDetail(); break;
case 6: cout << "\n===PERFORMANCE METRICS===" << endl;
p.displayPerformanceMetrics(); break;
case 7: cout << "\n===ADMIN===" << endl; a.updateVehicleInfo(v); break;
case 0: cout << "Exiting" << endl; break;
default: cout << "Invalid choice" << endl; break;
}
} while (choice != 0);

return 0;
}

You might also like