Algorithm of Project
Algorithm of Project
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