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++;
        }

    }

Recommended Answers

All 2 Replies

Dear koketa;
Please ask direct question because no one will read all you wrote; ask for example I've exception in lmlma how to slove it, I can't nither read your code nor understand it. just go around this forum and see how people ask
Cheers :)

Thanks for the tip on how to ask ?'s,

basically i need help finding a way to do a loop (i tried a do...while but it repeats the same number over and over again) and calculate the running total of money at the end of the day.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.