Hello eveyone, I am kindda new to daniweb. I was hoping that someone would give me some hints on where to put the running total and how to quit once the user types 0 for hours parked(my teacher asked for this feature)
I would enormously appreciate the help!
A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10. Assume that no car parks for longer than 24 hours at a time. Write a program that calculates and prints the parking charges for each customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. The application should display the charge for the current customer and should calculate and display the running total of yesterday’s receipts. The application should use method CalculateCharges to determine the charge for each customer.
{
int CustomerCount = 1;
Console.WriteLine("How many hours did Customer {0} parked for: ", CustomerCount);
int HoursParked = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Customer {0} parked for {1} hour(s).", CustomerCount, HoursParked);
double CalculateCharges;
{
if ((HoursParked < 0) || (HoursParked > 24))
Console.WriteLine("Invalid Number...[.1-24] only");
else
{
if (HoursParked <= 3)
CalculateCharges = 2;
else if ((HoursParked > 3) && (HoursParked <= 19))
CalculateCharges = 2 + (HoursParked - 3) * (.5);
else
CalculateCharges = 10;
Console.WriteLine("The total cost is {0:c}", CalculateCharges);
}
CustomerCount++;
}
}