Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Cars: First 2hours Free Next 3hours 0.50/hour Next 10 hours.25/hour Trucks: Firs

ID: 3612989 • Letter: C

Question

Cars:

        First 2hours    Free

        Next 3hours   0.50/hour

        Next 10 hours.25/hour

Trucks:

        First 1hour     Free

        Next 2hours   1.00/hours

        Next 12 hours0.75/hour

Senior Citizens: Free of charge

Write a program that will accept as input a one-characterdesignator (C, T or S)

Followed by two military numbers in range of 0600-2200 (6:00 A.Mto 10:00 P.M). The program should

Then compute the appropriate charge and the round up time thatcar was parked.

The output should be printed for each vehicle , arrival time,departure time and cost. Your program should also provide a summerat the end of each day indicating total cars, trucks, and senior ,time and fees. Your program should have loop which ends with^Z.

Explanation / Answer

please rate - thanks #include #include #include #include int main() {int i; char type,ch; int enter,exit,cars=0,trucks=0,senior=0,cat1,cat2,cat3,hours; double time=0,fees=0,p1=0,p2,p3,totfees=0; do { printf("Enter category (C)ar,(T)ruck, (S)enior (Ctrl Z whendone): "); scanf("%c",&type); type=toupper(type); if(type!='C'&&type!='S'&&type!='T')        printf("invalidcategory "); }while(type!='C'&&type!='S'&&type!='T'); while(true)    {do    {printf("What time did the vehicle enter 0600-2200?");    scanf("%d",&enter);    if(enter=2200)       printf("Sorry impossible-the lot wasclosed!! ");    }while(enter=2200);    do    {printf("What time did the vehicle exit 0600-2200?");    scanf("%d",&exit);    if(exit2200)       printf("Sorry impossible-the lot wasclosed!! ");    }while(exit2200); hours=((exit-enter)+59)/100; while ((ch = getchar()) != ' ' ) fees=0; switch(type) {case 'C':cat1=2;           cat2=3;           cat3=10;           p2=.5;           p3=.25;           cars++;           break;      case 'T':cat1=1;           cat2=2;           cat3=12;           p2=1;           p3=.75;           trucks++;            break; case 'S':        senior++;           p2=0; } time+=hours; if(p2!=0)       {hours-=cat1;       if(hourscat2)           {fees=cat2*p2+fees;             hours-=cat2;             }       else           {fees=hours*p2+fees;           hours=0;            }       if(hours>cat3)            fees=cat3*p3+fees;                else           fees=hours*p3+fees;            } totfees+=fees; printf("Vehicle type:   %c ",type); printf("Arrival Time:   %d ",enter); printf("Departure Time: %d ",exit); printf("cost:         $%7.2f ",fees); do { printf("Enter category (C)ar,(T)ruck, (S)enior (Ctrl Z when done):"); if(scanf("%c",&type)!=1)    {printf(" Daily Summary: "); printf("Total Cars:    %d ",cars); printf("Total Trucks: %d ",trucks); printf("Total Seniors: %d ",senior); printf("Total Time:    %d hours ",time); printf("Total Fees:   $%7.2f ",totfees); getch(); return 0; } type=toupper(type); if(type!='C'&&type!='S'&&type!='T')       printf("invalid category "); }while(type!='C'&&type!='S'&&type!='T'); } }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote