title: (Java Beginner) - Having trouble with a program
body: <p>Ok so I am working on a program that involves loans and gives information to the user about loans from what the user inputs. </p>
  
  <p>The purpose of this program I am writing is for the user to be asked to input a loan amount and the number of years that they have to pay it off. Once the user has given this information, the program will take the loan amount and number of years and tell the user the annual interest rate, monthly payment and the total amount. 
  ALSO, if the user enters a loan amount of -1, the program is supposed to terminate. </p>
  
  <p>Below is my code thus far:</p>
  
  <pre><code>package Loans;
  
  import java.util.Scanner;
  
  public class Loans {
  
      public static void main(String[] args) {
  
          Scanner input = new Scanner (System.in);
  
          double monthlyInterestRate;
          double annualInterestRate;
          double monthlyPayment;
          double total;
          double numberOfYears;
          double loanAmount;
  
          System.out.println("This program will compute the monthly payments and total payments for a loan amount on interest rates starting at 5%, incrementing by 1/8th percent up to 8%.");
  
          //Formula to Calculate Monthly Interest Rate:
          monthlyInterestRate = (annualInterestRate/1200);
  
          //Formula to Calculate Monthly Payment:
          monthlyPayment = (loanAmount*monthlyInterestRate);
  
          //Formula To Calculate Annual Interest Rate:
          annualInterestRate = (1-(Math.pow(1/(1 + monthlyInterestRate), numberOfYears * 12)));
  
          //Formula To Calculate The Total Payment:
          total = (monthlyPayment*numberOfYears*12);
  
          while(true)
          {
  
  
              System.out.println("Please enter in the loan amount.");
              double loanAmount = input.nextDouble();
              System.out.println("Please enter in the number of years.");
              double numberOfYears = input.nextDouble();
  
              System.out.println("Interest Rate: " + annualInterestRate);
              System.out.println("Monthly Payment: " + monthlyPayment);
              System.out.println("Total Payment: " + total);
  
              }
      }
  }
  </code></pre>
  
  <p>This does not compile and I'm not sure why. (Again, I'm a beginner) </p>
  
  <p>The errors I am receiving are on the line that reads "double loanAmount = input.nextDouble();" AND the line that reads "double numberOfYears = input.nextDouble();". </p>
  
  <p>The error for the first line says, "Duplicate local variable loanAmount". </p>
  
  <p>The error for the second line says, "Multiple markers at this line
      - Line breakpoint:Loans [line: 39] - 
       main(String[])
      - Duplicate local variable numberOfYears"</p>
  
  <p>Any feedback is appreciated. </p>