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

Assignment.8

The RGUKT Parking Portal is a C application designed to manage parking for 2 and 4 wheeler vehicles, allowing users to park in available slots and calculate parking fees based on duration. The application includes user authentication, vehicle details input, and billing calculations, including taxes and extra charges. It also tracks parking slot availability and displays the current parking status and admin profit after each transaction.

Uploaded by

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

Assignment.8

The RGUKT Parking Portal is a C application designed to manage parking for 2 and 4 wheeler vehicles, allowing users to park in available slots and calculate parking fees based on duration. The application includes user authentication, vehicle details input, and billing calculations, including taxes and extra charges. It also tracks parking slot availability and displays the current parking status and admin profit after each transaction.

Uploaded by

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

1.Create a c application named RGUKT PARKING PORTAL which has to satisfy given requirements.

The
purpose of this application is to park 2 or 4 wheeler vehicles in the free slots of available slots and also
calculate the amount to be payed based on the avail of parkinng

CODE:

#include<stdio.h>

#include<string.h>

int main(){

printf(".....RGUKT PARKING PORTAL.....\n");

printf("parking slots: 0 for free slots, 1 for occupied slots:\n");

char id[100];

int prof[100];

int profit=0;

char lg;

int enid;

static int d=0;

char pw[15];

int vehical[8][12];

int i,j,k=0;

int bill=0;

float billt=0;

int c1=0,c2=0,r1=0,r2=0;

int s=0,s1=0,c=0,c4=0;

int k1,k2;

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

for(j=0;j<12;j++){

vehical[i][j]=0;

printf(" %d",vehical[i][j]);
}

printf("\n");

int h=1;

while(h==1){

int sample=1,sample1=1;

printf("enter user id:\n");

while(sample){

scanf("%s",&id);

for(i=3;id[i]!='\0';i++){

if(strlen(id)==7){

if(id[0]=='n'||id[0]=='N'){

if(id[1]=='2'&&id[2]=='0'){

if(id[i]>='0'&&id[i]<='9'){

sample=0;

else{

printf("enter valid id\n");

break;

else{

printf("enter valid id\n");

break;

}
else{

printf("enter valid id\n");

break;

else{

printf("enter valid id\n");

break;

}} }

while(sample1){

printf("enter your password:\n");

scanf("%s",&pw);

if(strlen(pw)>=6&&strlen(pw)<=9){

int uc=0,lc=0,sc=0,num=0;

for(i=0;pw[i]!='\0';i++){

if(pw[i]>='A'&&pw[i]<='Z'){

uc++;

if(pw[i]>='a'&&pw[i]<='z'){

lc++;

if(pw[i]>='0'&&pw[i]<='9'){

num++;

if(pw[i]>=33&&pw[i]<=47||
pw[i]>=58&&pw[i]<=64||pw[i]>=91&&pw[i]<=96||pw[i]>=123&&pw[i]<=126){

sc++;
}

if(uc>=1&&lc>=1&&num>=1&&sc>=1){

printf("login successfully completed...\n");

printf("your id:%s\n",id);

sample1=0;

enid=id[3]+id[5]*2;

printf("Encoded id:%d\n",enid);

int A;

int E;

int F,G;

char B[5];

char C[5];

char D[10];

char details[10];

printf("enter the of your vehicle 2/4:\n");

scanf("%d",&A);

printf("do you have helmet or not? Y for yes N


for no:\n");

scanf(" %s",&B);

printf("are you a boy(B) or girl(G):\n");

scanf(" %s",&C);

printf("Enter your name:\n");

gets(D);

scanf("%s",&D);

printf("enter your age:\n");

scanf("%d",&E);
printf("enter no of hours to park(24 hour format):\n");

scanf("%d",&F);

if(F<=9){

printf("%d%s%s%c%d%d%d\
n",A,B,C,D[0],E,0,F);

printf("Vehicle type:%d wheeler\nHelmet:%s\nGender:%s\nName


starts with:%c\nAge:%d\nTime of avail parking:%d%d\n",A,B,C,D[0],E,0,F);

}else{

printf("%d%s%s%c%d%d\n",A,B,C,D[0],E,F);

printf("Vehicle type:%d wheeler\nHelmet:%s\nGender:%s\nName


starts with:%c\nAge:%d\nTime of avail parking:%d\n",A,B,C,D[0],E,F);

if(E<21&&A==2){

printf("you are not allowed to park\n");

}else if(A==2){

c++;

int c3=0;

if(c%12==0){

c3=c-1;

k2=c3/12;

}else{

k2=c/12;

if(s==12){

s=0;

int n=s+1;

for(s;s<n;s++){
if(vehical[k2*2][s]==0){

vehical[k2*2][s]=1;

}else if(A==4){

c4++;

int c2=0;

if(c1%12==0){

c2=c4-1;

k1=c2/12;

}else{

k1=c4/12;

if(s1==12){

s1=0;

int n1=s1+1;

for(s1;s1<n1;s1=s1+1){

if(vehicle [(k1*2)+1][11-s1]==0){

vehicle[(k1*2)+1][11-s1]=1;

} else{

}
//bill

printf("Your bill:\n");

if(A==2){

if(B[0]=='N'||B[0]=='n'){

bill=(25*F)+50;

if(bill<=50){

billt=bill;

printf("Actual cost:%d\nTax cost:%d\nExtra charges:


%d\nTotal Bill:%0.2f\n",bill,0,50,billt);}

else if(bill>50&&bill<=150){

billt=bill+(0.07*bill);

printf("Actual cost:%d\nTax cost:%d%\


nExtra charges:%d\nTotal Bill:%0.2f\n",bill,7,50,billt);

}else if(bill>150){

billt=bill+(0.28*bill);

printf("Actual cost:%d\nTax cost:%d%\


nExtra charges:%d\nTotal Bill:%0.2f\n",bill,28,50,billt);

}else{}

}if(B[0]=='Y'||B[0]=='y'){

bill=25*F;

if(bill<=50){

billt=bill;

printf("Actual cost:
%d\nTax cost:%d\nExtra charges:%d\nTotal Bill:%0.2f\n",bill,0,0,billt);

else if(bill>50&&bill<=150){

billt=bill+(0.07*bill);

printf("Actual cost:%d\nTax cost:%d%\nExtra


charges:%d\nTotal Bill:%0.2f\n",bill,7,0,billt);
}else if(bill>150){

billt=bill+(0.28*bill);

printf("Actual cost:%d\nTax cost:%d%\nExtra


charges:%d\nTotal Bill:%0.2f\n",bill,28,0,billt);

}else{} }

if(A==4){

bill=50*F;

if(bill<=50){

billt=bill;

printf("Actual cost:%d\nTax cost:%d\nExtra charges:%d\


nTotal Bill:%0.2f\n",bill,0,0,billt);

}else if(bill>50&&bill<=150){

billt=bill+(0.07*bill);

printf("Actual cost:%d\nTax cost:%d\nExtra


charges:%d\nTotal Bill:%0.2f\n",bill,7,0,billt);

}else if(bill>150){

billt=bill+(0.28*bill);

printf("Actual cost:%d\nTax cost:%d%\nExtra


charges:%d\nTotal Bill:%0.2f\n",bill,28,0,billt);

}else{}

int y=d+1;

for(d;d<y;d++){

prof[d]=bill;

profit=profit+prof[d];
}

float amt;

printf("enter given amount:\n");

scanf("%f",&amt);

printf("change has to give:%0.1f\n",amt-billt);

printf("If you want to continue press Y else logout N:\n");

scanf(" %c",&lg);

if(lg=='N'){

h=h-1;

//present parking

printf("present parking:\n");

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

for(j=0;j<12;j++){

printf(" %d",vehical[i][j]);

printf("\n");

//aftr rotating

printf("after rotating:\n");

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

for(j=0;j<8;j++){

printf(" %d",vehical[j][i]);

printf("\n");

printf("admin profit:%d\n",profit);
}

}else{

printf("enter valid password\n");

}else{

printf("enter valid password\n");

}}

return 0;

You might also like