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
Re: Solving the parking lot fees problem with java
Look into using the mod operator, %, and int division, /.
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
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