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

Car Renting System (1)

Uploaded by

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

Car Renting System (1)

Uploaded by

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

CAR RENTING SYSTEM

“UNLOCK THE ROAD TO FREEDOM: YOUR JOURNEY STARTS HERE!”

Exploring A C++ Project


By: MD KASHIF AND AMRIT LAL
PGDCA (2023-2024)
GOVT. E.V.P.G. COLLEGE KORBA (CG.)
Introduction
TO

CAR RENTING SYSTEM

Project Overview Importance of Car Renting System


System

Renting system for cars • Facilitates convenient transportation


access
• Facilitate short-term vehicle access
• Display, rent, return cars
• Optimizes vehicle utilization and
• User-friendly interface revenue
• Efficient car management • Offers flexible rental options for users
Objectives
1 Enhancing Mobility 2 Optimizing Vehicle 3 Providing Flexible
Solutions: Utilization: Rental Options:
• Increase transport • Maximize rental fleet • Customize rental plans.
accessibility. usage.
• Cater to diverse needs.
• Support urban mobility • Reduce idle vehicle
needs. time. • Enhance customer
• Provide convenient • Minimize maintenance
satisfaction.
travel options costs.
Architecture

1 Class Structure: 2 Functionality:


The ‘car’ class provides methods
This code utilizes a single class, to
“car”, to represent car objects.
• display car details
• rent a car
• return a car
• rental status

3 Main Function: 4 Flow Control:


• The ‘main()’ function serves as • controlled by a ‘do-while’ loop,
the entry point of the program. continues until the user chooses to
exit the program.
• It manages user interaction
through menu-driven interface. • Use of ‘switch’ case within the loop
Class
class Car {
public:
int id;
char model[100];
int year;
Car Class Attributes int rented;

The Car class attributes like Car() { id = 0;


model[0] = '\0';
• Car id, year = 0;
rented = 0; }
• Car model,
• Year, void init(int id, const char* model, int year) { this->id = id; this->year
• Rented Status = year; this->rented = 0; }

Enabling effective Renting int isAvailable() const {


management. return !rented; }

void rent() {
rented = 1; }

void returnCar() {
rented = 0; }
};
Functionality
The ‘car’ class provides methods to

Display Car Details

Rent a Car

Return car

Rental status
DISPLAY AVAILABLE CARS
void initializeCars() {

cars[0].init(1, "Maruti Swift", 2022);


cars[1].init(2, "Hyundai Venue", 2021);
cars[2].init(3, "Tata Nexon", 2022);
cars[3].init(4, "Mahindra Thar", 2020);
cars[4].init(5, "Kia Seltos", 2023);
cars[5].init(6, "Range Rover", 2020);
cars[6].init(7, "Ferari Tera", 2023);
}
void rentCar() {
displayAvailableCars(); RENT A CAR
int carID;
int i;
cout << "\n\n\n\n\tEnter Car ID to rent:";
cin >> carID;

for (i = 0; i < 7; ++i) {


if (cars[i].id == carID &&
cars[i].isAvailable()) {
cars[i].rent();
cout << "\n\tCar rented
successfully!\n\n\n\n";
break; // Break once the car is
rented
}}
if (i == 7) {
cout << "\n\tCar not available for rent or
invalid Car ID.\n\n\n";
}
RETURN A CAR
void returnCar() {
displayRentedList();
int carID;
int i;
cout << "\ntEnter Car ID to return: ";
cin >> carID;

for (i = 0; i < 7; ++i) {


if (cars[i].id == carID) {
cars[i].returnCar();
cout << "\n\tCar returned
successfully!\n";

break; }
void displayRentedList() const {

cout << RENTED LIST


"\n\t=======================Rented
List=========================\n\n";

for (int i = 0; i < 7; ++i) {


if (!cars[i].isAvailable()) {
cout << "\t ID: " << cars[i].id <<
"\t\t Model: " << cars[i].model
<< "\t\t Year: " << cars[i].year
<< '\n';

}}
do {
int main() { cout<< "\n\t\t\t -----------------------\n" ;
cout<<"\t\t\t |** CAR RENTAL MENU **|";
cout<<"\t\t THIS PROGRAM IS DEVELOPED cout<<"\t\t\t\t\t\t\t -----------------------\n\n";
cout<<"\t\t\t 1. Display Available Cars\n\n";
BY KASHIF AND AMRIT\n\n";
cout<<"\t\t\t 2. Rent a Car";
cout <<"\t\t cout<<"\n\n\t\t\t 3. Return a Car\n\n";
************************************ cout<<"\t\t\t 4. Display Rented List\n\n\t\t\t";
*************"; cout<<" 0. Exit\n";
cout <<"\n\t\t ========== * CAR cout<<"\n\t\t\t Enter your choice: ";
RENTING SYSTEM * =========\n";
cin >> choice;
cout <<"\t\t
************************************ switch (choice) {
*************\n"; case 1:
cout <<"\n\t\t ====== ** Welcome to Car rentalSystem.displayAvailableCars();
break;
Renting House ** =======\n";
case 2:
rentalSystem.rentCar();
CarRentalSystem rentalSystem; break;
int choice; case 3:
rentalSystem.returnCar();
break;
rentalSystem.initializeCars();
case 4:
rentalSystem.displayRentedList();
break;
case 0:
cout << "\n\n\n\t\tExiting the Car
Rental System. Thank
you!\n\n\n\n\n\n\n\n\n\n";
break;
default:
cout << "\n\n\n\t\tInvalid choice.
Please enter a valid option.\n";
}

} while (choice != 0);

return 0;
}
Conclusion

Recap of Key Points


Thank You!
BY: MD KASHIF AZEEM AND AMRIT LAL
• Facilitates convenient transportation PGDCA(2023-2024)
access .
GOVT. E.V.P.G COLLEGE KORBA (C.G.)
• Facilitate short-term vehicle access
• Optimizes vehicle utilization and revenue
• Offers flexible rental options for users

You might also like