# Solving the parking lot fees problem with java

• 09-10-2012, 09:24 PM
511prs
Solving the parking lot fees problem with java
hi there, I need to solve this:

In a parking they charge 5\$ for the first 3 hours and for each extra hour you'll be charge 1\$ and 24 hrs is 12\$ but in here you can stay more than 24 hours, I don't know how to solve the hours>24 like 37 hours, any help ??

thanks
• 09-11-2012, 02:58 AM
Fubarable
Re: Solving the parking lot fees problem with java
Look into using the mod operator, %, and int division, /.
• 09-13-2012, 05:32 AM
511prs
Re: Solving the parking lot fees problem with java
But I need like the ecuation for the +24 because I have to charge 12 by day and 1 per extra hour, an example if the car stays there 37 hours what ecuation could I use to calculate the fees and put them in the program
• 09-13-2012, 08:56 AM
srinivas321
Re: Solving the parking lot fees problem with java
First get the total no of hours..write one if condition then %24 then calculate dollers