Solving the parking lot fees
<p>I have a problem </p>

<p>Parking charge is 3$ per hour for the first 3 hours and for each extra hour you'll be charged 1$ and 24 hrs is 30$ but you can stay more than 24 hours.
I don't know how to solve the hours>24 like if car stays there for 37 hours, or more. I think that modulus has to be used for this, unfortunately I cant get this working.  any help ??</p>

<pre><code>        if (hours &gt;= 24) {
            price = 30;
            price += (hours - 3) % 1; //should the mod even go here?
        } else if (hours &lt; 24 &amp;&amp; hours &gt; 3) {
            price = 9;
            price += (hours - 3) * 1;
        } else {
            price = hours * 3;
        }
        System.out.println("Hours: " + hours + " Price: " + price);
</code></pre>