Design a project of vehicle parking in C++
Design a project of vehicle parking in C++. Designing a program of vehicles parking from which we can collect useful information. This information can be used by people to get the idea either there is free space in parking area or not.
This program would basically work in place of traffic parking workers, for example noting and evaluating different cost of different types of vehicles etc.
So let’s describe the program and the code used as well.
First of all we would use header file #include<iostream.h> because we are using cin and cout operations. As we have used this header file and will be working on cin and cout we would write/use using namespace std after header file. After that, int main would be used followed by return o.
This was the format but the main thing we would be doing would be in body.
First, we would would be giving options to the traffic worker by cout that what he has to do, like noting down an entering vehicle and what type of vehicle etc. so we would declare an input also.
We would use while true loop because we are working on a program which would give multiple results repeatedly.
And in the loop after giving options by cout, we would use if else statements like we would give conditions that which type of vehicle is parked. After which we would store that fixed amount(price) of that vehicle and store the information. As we have more than two conditions so we would use else if instead of only else. And in if else we would write the second condition i.e the second type of vehicles. And as done previously we would store data.
We would be doing same process till we are completed with types of vehicles to be parked, After the in next condition (next if else) we would be calculating the total amount of fee for the vehicles parked.
After this we would be working in our program to clear the stored data. For that we would just input total fee amount and number of vehicles as 0.
Furthermore, if traffic worker/user mistakenly uses/types another key/option we would show the result as invalid output.
This would be our program and after this we would terminate our program using return 0.
C++ code for vehicle parking project:
using namespace std;
cout<<“press 1 for rikshaw”<<endl;
cout<<“press 2 for car”<<endl;
cout<<“press 3 for bus”<<endl;
cout<<“press 4 to show the record”<<endl;
cout<<“press 5 to delete the record”<<endl;
amount=amount + 100;
cout<<“the total amount = “<<amount<<endl;
cout<<“the total number of vehicles parked is =”<<count<<endl;
cout<<“invalid number “<<endl;
General information and usage of program:
When we would compile the program a screen would appear having some options that which vehicle is parked like(rikshaws, cars, or buses).
A rikshaw would be charged 100 rupees, and this would be stored and added to any next entered amount. Car would be charged 200 and Bus would be charged 300.
So if any rikshaw will be parked user of program will enter the statement of rikshaw and price of rikshaw would be stored.
Likewise, same would be done with other vehicles, just amount would be changed.
If the user of program would like to check total amount to be collected from vehicles, he would choose the option from output screen.
Benefits of program:
Hard job of a traffic worker would easily be handled with a PC.
Output of the project
Also read here:
One thought on “Design a project of vehicle parking in C++”