Write a program to calculate the parking charges of a vehicle. Enter the type of vehicle as a character (like c for car, b for bus etc) and the number of hours. Then calculate the charges as given below. [Program must be implemented using Switch and else-if] • Truck / Bus - Rs 20 per hour • Car - Rs 10 per hour • Scooter/ Cycle/ Motor cycle - Rs 5 per hour
#include < stdio.h>
void main()
{
int car=10,bus=20,Sc=5,noofhours, charges=0;
char choice;
printf("Please enter vehicle details c-car b-bus and s-scooter \n");
scanf("%c”, &choice);
printf("Please enter no of hours");
scanf("%d",&noofhours);
switch(choice)
{
case 'c': charges=car*noofhours;
printf("Parking charges for your car = %d \n",charges);
break;
case 'b': charges=bus*noofhours;
printf("Parking charges for your bus = %d \n",charges);
break;
case 's': charges=Sc*noofhours;
printf("Parking charges for your Scooter = %d \n",charges);
break;
default: printf("Invalid Choice \n");
}
}