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

Algorithm of Project

Uploaded by

satanslave000
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)
12 views

Algorithm of Project

Uploaded by

satanslave000
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/ 2

Department of Biomedical Engineering Technology

The Superior University, Lahore


Computer Programming
Algorithm of the Project

Project: Basic Car Rental System


Step 1: Start
Step 2: Initialize • Defining ‘MAX_CARS’, ‘MAX_MODEL_LENGTH’,
Constants and ‘MAX_NAME_LENGTH’ as constants.
Structs • Defining ‘Model’, ‘Rental Rates’, ‘Quantity’, ‘Rental Days
Left’ as the structure of the variable “Car”.
• Defining ‘Name’, ‘Rented Model’, ‘Phone Number’, ‘Rental
Cost’, ‘Rented Model’ as the structure of variable “Customer”.
Step 3: Function • login(): Authenticate user with password.
Definitions • displayWelcome(): Display welcome message.
• displayMenu(): Display menu options.
• addCar(): Add a new car to the fleet.
• displayFleet(): Display details of cars in the fleet.
• rentCar(): Rent a car to a customer.
• returnCar(): Process return of a rented car.
• displayThanks(): Display farewell message.
• initializeFleet(): Initialize the fleet of cars with predefined
data.
Step 4: • Call ‘login()’ to authenticate user.
Initialization the • Display welcome message using ‘displayWelcome()’.
Main Function • Initialize the fleet of cars using ‘initializeFleet()’.

Step 5: User • Enter a “do-while” loop to repeatedly display the menu


Interaction Loop ‘displayMenu()’, that promote the user to take actions
according to his choices as many times as he want.
• Choices include adding a car, displaying the fleet, renting a
car, returning a car, and exiting the program.

Step 6: Login • Display Heading “CAR RENTAL SYSTEM”.


Function “login()” • Promote user to enter the password before displaying the fleet
of Rental Cars.
• If password is correct than ‘Access Granted’ to the fleet of
Rental Cars.
• Else ‘Access Denied’ and again call the login function to enter
the correct password.
Step 7: Add a Car • Check if maximum capacity (MAX_CARS) has been reached.
“addCar()” • Prompt user for details of the new car (model, rental rate,
quantity).
• Add the new car to the `cars` array and update ‘numCars’.
Step 8: Display • Check if there are cars in the fleet “numCars > 0”.
Fleet • Iterate through the `cars` array and display details (model,
“displayFleet()” rental rate, quantity, days left on rental).

Step 9: Rent a Car • Prompt user for the model of car to rent.
“rentCar()” • Find the car in the ‘cars’ array ‘findCarIndex()’.
• If available, prompt for customer details (name, phone
number, rental days).
• Calculate total cost and update car quantity and rental days
left.
• Display an invoice with customer and rental details.

Step 10: Return a • Prompt user for the model of car to return.
Car “returnCar()” • Find the car in the ‘cars’ array.
• Increase the quantity of the returned car and reset rental days
left.
• Display confirmation message.
Step 11: • Use this function to store several cars with their ‘model’,
Initialization Fleet ‘rental rates’, ‘quantity’, ‘days left for rented’ in the attributes
“initializeFleet()” of car1, car2, car3 and so on
• Add the attributes as the proper elements of the array of cars.

Step 12: Exit • When user chooses to exit (‘choice == 5’), display thank you
message using ‘displayThanks()’.
Step 13: End

You might also like