3. (6 pts) As indicated at http://www.flymemphis.com/parking. Memphis Internatio
ID: 3730497 • Letter: 3
Question
3. (6 pts) As indicated at http://www.flymemphis.com/parking. Memphis International Airport uses the following pricing schedule for their short-term parking fees: Time First 30 minutes 31 to 60 minutes Each additional 30 minutes 24-hour maximunm Pricing FREE $2.00 $1.00 $24.00 Within a new class named Parking, write a method that takes a parameter for the number of minutes parked (you can assume it's a whole number) and returns the appropriate short-term parking charge, in dollars. Assume that the airport will always round UP to the next half-hour for example, parking exactly 60 minutes would cost $2, but 61 minutes would make it $3. After all, they want to make as If the method is called with a zero or negative argument, make it return zero. If the method is called example, parking for 1471 minutes would result in a charge of $26. The first 1440 minutes (24 hours) much money as possible! with an argument exceeding 24 hours, the 24-hour maximum listed in the table should be applied to each complete day, and any partial day should be charged according to the schedule in the table. For cost $24, the next 30 minutes is free, and the next 1 minute costs $2. 4. (3 pts) Within the same Parking class, write a main method that makes at least six calls to your parking method using different arguments and prints the return value from each call. Test a wide range of values to ensure your method works correctlyExplanation / Answer
3)
void parking :: method()
{
for( int k=0; k< 100; k++)
{ if( time<= 30 )
charge = 0;
else
if( time> 30 && time <=60)
charge = 2.00
else
if(time >60 && time <1440)
{time = time-60; charge = charge+2;
for(int i=1; i< 50; i++)
{if(time >= 30)
{time = time-30;
charge = charge+1; }
else
if(time>0 && time<30)
chage = charge+1;
else if(time==0)
endl;
}
}
else if(time>= 1440)
{ time = time-1440;
charge = charge+24; }
else endl;
}}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.