My Project 2:
Minor C project: Vehicle Parking Revenue Calculator
This project tells us the number of 2-wheelers (eg bikes, cycles), 3-wheelers (eg auto rickshaws), and 4-wheelers (eg cars) that got parked on that day. It also tells us the total number of vehicles present in the parking area. Finally, this project calculates parking revenue generated by various vehicles.
Code:
#include <stdio.h>
#include<conio.h>
#include<stdlib.h>
int menu();
void remove();
void showdetail();
void bus();
void cycle();
void rickshaw();
int nob=0,nor=0,noc=0,count=0,amount=0;
void main()
{
while(1)
{
clrscr();
switch(menu())
{
case 1:bus();
break;
case 2:cycle();
break;
case 3:rickshaw();
break;
case 4:showdetail();
break;
case 5:remove();
break;
case 6: exit(0);
default : printf("\n\nInvalid choice");
}
getch();
}
}
int menu()
{
int choice;
printf("\nEnter 1 for bus entry:");
printf("\nEnter 2 for cycle entry:");
printf("\nEnter 3 for rickshaw entry:");
printf("\nEnter 4 to show status:");
printf("\nEnter 5 to delete data:");
printf("\nEnter 6 to Exit System:");
printf("\n\nEnter your choice:");
scanf("%d",&choice);
return (choice);
}
void remove()
{
nob=0,nor=0,noc=0,count=0,amount=0;
}
void showdetail()
{
printf("\nNo. of buses=%d",nob);
printf("\nNo. of cycles=%d",noc);
printf("\nNo. of rickshaw=%d",nor);
printf("\nTotal no. of vehicles=%d",count);
printf("\nTotal amount collected=%d",amount);
}
void bus()
{
printf("\n\nEntry of bus is successful:");
nob++;
amount+=100;
count++;
}
void cycle()
{
printf("\n\nEntry of cycle is successful:");
noc++;
amount+=20;
count++;
}
void rickshaw()
{
printf("\n\nEntry of rickshaw is successful:");
nor++;
amount+=50;
count++;
}
Comments
Post a Comment