title: Beginner Java programmer arithmetic error
body: <p>I've recently embarked into Java programming and consider myself a programing novice. It seem that I'm having an issue with my source code arithmetic. I have verified all the nested if-else statements and they all work up to the final else statement's arithmetic. It doesn't calculating correctly I have set the arithmetic up just as the above if-else statements. </p>
  
  <p>the else statement is suppose to subtract 40 from the amount and then apply 1 percent charge.</p>
  
  <p>This is just an exercise from the book</p>
  
  <pre><code>import java.util.Scanner;
  public class ServiceCharge {
  public static void main(String[] args)
  {
      double checkAmount;
      double fee;
      Scanner kb = new Scanner(System.in);
      System.out.println("I will calulate the service charge to cash your check");
      System.out.print("Enter amount of check: $");
      checkAmount = kb.nextDouble();
  
      if (checkAmount &gt; 0)
      {
          if (checkAmount &lt;= 10)
          {
              fee = -1;
              System.out.println("$1 service charge");
              checkAmount = checkAmount + fee;
              System.err.println("You have " + checkAmount + " left after service charge.");
          }
          else if ((checkAmount &gt; 10) &amp;&amp; (checkAmount &lt;= 100))
          {
              System.out.println("There will be a 10 percent charge.");
              fee = (checkAmount * .10);
              checkAmount = checkAmount - fee;
              System.out.printf("Processing fee: $%.2f\n" , fee);
              System.out.printf("Check amount: $%.2f\n" , checkAmount);
          }
          else if ((checkAmount &gt; 100) &amp;&amp; (checkAmount &lt;= 1000))
          {
              System.out.println("There will be a $5 charge plus 5 percent");
              fee = ((checkAmount - 5) * .05);
              checkAmount = (checkAmount - fee);
              System.out.printf("Processing fee: $%.2f\n" , fee);
              System.out.printf("Check amount: $%.2f\n", checkAmount);
          }
          else
          {
              System.out.println("$40 processing fee plus 1 percent");
              fee = ((checkAmount - 40) * .01);
              checkAmount = (checkAmount - fee);
              System.out.printf("Processing fee: $%.2f\n" , fee);
              System.out.printf("Check amount: $%.2f\n" , checkAmount);
          }
          System.out.println("Thanks for using Service Charger." + "\nGood bye");
      }
  }
  }
  </code></pre>
  
  <p>Revised code</p>