# Thread: Solving the parking lot fees problem with java

1. Member
Join Date
Aug 2012
Posts
6
Rep Power
0

## 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

2. ## Re: Solving the parking lot fees problem with java

Look into using the mod operator, %, and int division, /.

3. Member
Join Date
Aug 2012
Posts
6
Rep Power
0

## 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

4. Member
Join Date
Sep 2012
Posts
2
Rep Power
0

## 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

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•