If
there is a place to park the vehicles, then some n number of vehicles are
parked there and then count how many are of cars and how many of are scooters and note the arrival time
and the departure time. Display the order of parked vehicles and colour of the
vehicle. If he wants to take the vehicle from the parking he has to tell the
number of vehicle. If he says wrong number he is unable to the vehicle from the
parking. If he says the correct number then in that case he has to calculate the
parking fees for the time they had parked.
ABSTRACT:-
In some
malls we have car parking he has to allow to parking car in there is a space to
park. The vehicles we have to count how many cars & how many scooters and we have to arrival time and departure
time for parking fees .we have to note the time to count the cars &scooters
we know the how many wheels the vehicle has .If it is 4 then it is a car else
if it is 2 scooter. We have to enter the
number of the vehicle to take the vehicle from the parking else he has to he
wants to show the RC book & colour & also the model of the car
Finally he wants
to calculate the parking fee in this program .we have to use if else conditions
& do while loops
INTRODUCTION:-
The project is
about car parking.to solve this problem we have to know c-programming.
To write the
program code we use the for loops, if-else and else-if ladders conditions. In
this vehicle parking program code, we just read the number of vehicles. Then we
calculate by general terminology that a car has 4 wheels and a scooter has 2
wheels. At every stage we have to note the arrival and departure time. If he
says the correct vehicle number and colour he is eligible to take the vehicle.
If he says wrong he is not eligible to take the vehicle. In that case we have
to display the not eligible and show the RC
book and give the valid number. If he says correctly we calculate the fee per
hour which is 50 rupees per hour. By using hours*50.then we will display the
total cost he has to pay.
Hardware
& Software Required:-
software required is turbo c software.
HARDWARE:-we
have the software filled laptop to execute the program code
IF-ELSE
STATEMEMTS:-
This is a conditional statements .Then
if-else statements takes care of true as well as false conditions .It has two
blocks one block for if and it is executed when the condition is true .
The other block is
else and it is executed when the condition
is false .The else statement cannot be used without if .
FORMAT:-
If(the condition is true)
Execute the statements;
Else
Execute the statements;
Execution of this program
SYNTAX:
Of if-else statements given below
If(expression for true)
{
Statements 1; /* if block */
Statements 2;
}
Else
{
Statement 3; /* else block */
Statements
4;
}
IF
STATEMENTS :-(IF )
The if statements is executed only
when the conditions true. In case the condition is false; the compiler skips
the lives within the if block
SYNTAX:-
If(condition )
/*no semi-colon*/
Statement;
FOR LOOP:-
The
for loop allow to execute a set of instructions until a certain condition is
satisfied
Condition may be
predefined or open-ended
SYNTAX
:-
For(initialize counter; test condition ;
re evaluation parameter
{
Statement 1 ;
Statement 2 ;
}
ARRAY:-
Here in car parking there
are so many vehicles. So we have to take the vehicles of the array;
An
array is a collection of elements of same data type.
SYNTAX:-
Int
a[i];
Where
i is a size of the array
FOR
THE PROGRAM CODE:-
ALGORITHM:-
Step 1:- start
Step 2:-Declare
the arrival time and departure time also number of
wheels with 3 variables.
Step 3:-If number
of vehicles ==2
Count the scooters.
If number of wheels==2
Count the cars.
Step 4:-Declare
the array size and array name with some variables.
Step 5:-Declare
the vehicle number with some variable.
Step 6:-Check the
condition with IF statement if array value is equal to
entered vehicle number.
Step 7:-If yes
increase the count
If count equals to 1 print the output with
allowed to take the vehicle
Else
Print the output as not allowed show your RC
book and car type.
Calculate
Fees=tt*50.
Step
9:-If count=1
Print output as fee.
Else
Print no vehicle found.
Step 10:- stop
|
|
PROGRAM
CODE:-
#include <stdio.h>
#include <stdlib.h>
int main()
{
struct vehical
{
char color[20];
int h1,m1,h2,m2,veh_no,pt;
};
struct vehical v[100];
int n,i,noc=0,nos=0,nov=0,pf,j,s,flag=0,p,r,t;
char q[20];
printf("\n\t\t\t\t\twelcome to parking area ");
printf("\n\n To park your vehicle please enter the following details ");
printf("\n\n enter number of vehicles can be parked ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n enter color ,arrival time (hours min),vehicle number:");
scanf("%s%d%d%d",&v[i].color,&v[i].h1,&v[i].m1,&v[i].veh_no);
}
for(i=0;i<n;i++)
{
r=v[i].veh_no;
if(r%2==0)
{
noc=noc+1;
}
else
{
nos=nos+1;
}
nov=nov+1;
}
printf("\n \n \t \t display of order of vehicles parked");
for(i=0,j=1;i<n,j<=n;i++,j++)
{
printf("\n \n %d vehicle_no=%d\tcolour=%s\tarrival time=%d:%d",j,v[i].veh_no,v[i].color,v[i].h1,v[i].m1);
}
printf("\n \n \t \t no of vehicles=%d\tno of cars=%d\tno of scooters=%d",nov,noc,nos);
printf("\n \n To take vehicle out of parking please enter the following details");
for(i=0;i<n;i++)
{
printf("\n \nenter vehicle_no :");
scanf("%d",&p);
r=v[i].veh_no;
if(p==r)
{
printf("\n thanks for parking you can take your vehicle");
printf("\n enter depature time (hours min):");
scanf("%d%d",&v[i].h2,&v[i].m2);
v[i].pt=v[i].h2-v[i].h1;
pf=v[i].pt*2;
printf("\n parking fee is %d rupees",pf);
}
else
{
printf("\nvehicle number is wrong, please tell your vehicle model and color and show the vehicle's rc book");
}
}
printf("\n\n\n\n\n\n\t\t\t\t\tThe parking programe ends here\n\n\n\n\n\n\t\t\t \t******arise awake and stop not till the goal is reached ****** ");
printf("\n\n\n\n");
return 0;
}
INPUT:-
Arrival time=4:00 pm (at)
Departure time=6:00 pm (dt)
Total time=2 hours (tt)
Vehicle wheels=4 (nw)
array v[100]
Vehicle number=93 (number)
OUTPUT:-
Enter the arrival time : 4
Enter the departure time: 6
Enter the number of wheels: 4
cc=1
CONCLUSION:-
From this project we
learn how the vehicle parking is carried out in the malls. And also we can know
how to implement the for loops, if-else and else-if ladders in the program.


Comments
Post a Comment