Answer to Question #254497 in C for Vishnu

Question #254497
parking lot charges Rs.30 as a minimum fee to park a vehicle for up to 3 hours. An additional charge of Rs.5.00 per hour will be added if it exceeds three hours. for 24 hours the parking fees are Rs.80.00.Write a program to define an array and read the vehicle registration number, and hours parked for each customer and calculate the parking charges for 'n' customers and display the output.

Input format

The first line of the output consists of the number of customers.

The next n lines consists of the vehicle

registration number and total parking hours.

Output format

The output consists of the vehicle number, hours parked, and charges separated by a space.

Sample testcases

Input 1

3

1867 3

5382 5

2407 24

Output 1

1867 3 30.00

5382 5 40.00

2407 24 80.00
1
Expert's answer
2021-10-21T05:21:08-0400
#include<iostream.h>
int main(){

int rs[10],hours[10],cars[10];
for(int i=1;i<=10;++i){
cout<<"Enter number car number"<<endl;
cin>>cars[i];
cout<<"Enter parking hours"<<endl;
cin>>hours[i];

if(hours[i]<=3){

rs[i]=30;
cout<<rs[i]<<endl;

}
if(hours[i]>3 && hours[i]<24){

rs[i]=30+(hours[i]-3)*5;
cout<<rs[i]<<endl;

}
if(hours[i]==24){

rs[i]=80;
cout<<rs[i]<<endl;

}

}

return 0;}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS