(Java Beginner) - Having trouble with a program -


OK, so I'm working on a program that includes the loan and the user Gives information in

I am writing the purpose of this program, the user is asked to input the loan amount and the number of years from which he will have to pay. Once the user has given this information, the program will take the loan amount and the number of years and tell the user the annual interest rate, monthly payment and total amount. In addition, if the user enters the loan amount of -1, the program is considered to be terminated.

Below is my code:

  package loan; Import java.util.Scanner; Public category loans {public fixed zero main (string [] args) {scanner input = new scanner (System.in); Double magazines; Double Annual Interest; Double monthly payments; Double total; Double number of benefits; Double loan amount; System.out.println ("This program will increase the monthly payment and the total payment for the amount of loan at interest rates starting from 5%, up to 8% by 1 / 8th percentile."); // Formula for calculating Monthly Interest Rate: Monthly Interactrect = (Annual Interactive / 1200); // Formula for calculating monthly payment: Monthly payment = (Loan amount * Monthly schedule); // Formula for calculating the annual interest rate: AnnualInndrebet = (1- (MathPo (1 / (1 + Monthly Interactive), Numbers Year * 12)); // Formula to calculate the total payment: Total = (Monthly Payment * Numbers Year * 12); While {true} {System.out.println ("Please enter the loan amount."); Double loanemount = input.nextDouble (); System.out.println ("Please enter number of years."); Double numberoffires = input NXD double (); System.out.println ("Interest Rate:" + annual indigenous); System.out.println ("Monthly Payment:" + Monthly Payment); System.out.println ("Total Payment:" + total); }}}  

It does not compile and I'm not sure why (again, I'm starting one)

The error I'm getting The line is "double loan amount = input. Nxt double ();" And the row that is "double numerifier = input. Nxt double ();"

The error for the first line says, "Duplicate Local variable loan amount"

The error for the second line says, "Many markers in this line - line breakpoint: Loans [Line: 39] - Main (string []) - Duplicate local variables number offiers "

Any feedback is appreciated

The error you get is quite self explanatory. You have both defined both "loan amount" and "number two years" in the main or rename them or declare them only once.

If you are beginning to coding, then I recommend that you use an IDE such as Eclipse or Netbeans. They will tell the compilation errors how to decide them.


Comments