title: Logical Error in Conditional Statement If-Else Java
body: <p>I have this given problem that is: A computer rental has a REGULAR CHARGE per hour for the first three hours or less.  The excess of three hours would be charged by 10 percent less of the regular charge per hour. And my source code is:</p>
  <pre><code>    System.out.print(&quot;ENTER REGULAR CHARGE: &quot;);
      int charge = scan.nextInt();
      
      System.out.print(&quot;ENTER REGULAR HOURS: &quot;);
      int hours = scan.nextInt();
      
      scan.close();
      
      if (hours &lt;= 3)
      {
          int bill= charge * hours;
          System.out.print(&quot;RENTAL BILL IS: &quot; +bill);
      }
      else
      {
          double bill = (double) (charge * hours)-0.10;
          System.out.print(&quot;RENTAL BILL IS: &quot; +bill);
      }
  </code></pre>
  <p>and the expected output should be:</p>
  <pre><code>ENTER REGULAR CHARGE: 4
  ENTER REGULAR HOURS: 10
  RENTAL BILL IS: 39
  </code></pre>
  <p>but my outcome goes:</p>
  <pre><code>ENTER REGULAR CHARGE: 4
  ENTER REGULAR HOURS: 10
  RENTAL BILL IS: 39.9
  </code></pre>
  <p>I don't know if there's a problem in my formula or the variable that I used. It would be very helpful if someone pointed out the errors in my source code.</p>