Can you post the previous few lines of the code ... the problem could be in the previous lines too ... look at them.
nanosani
Unauthenticated Liar
1,830 posts since Jul 2004
Reputation Points: 45
Solved Threads: 56
The % is a sign for modular division in java.
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
you might want to play around with the DecimalFormat class some, if you want your numbers to have commas after every three numbers and an % before or after your numbers.
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
Try this out now
public class MortgageLoanCalculator
{
//Main method
public static void main(String [] args)
{
double interestRate = 5.7; // you are defining a double value .. and % is not a double.
int numberOfYears = 30;
double loanAmount = 20000; //java doesnt recognize comas in doubles.
//Enter monthly interest rate
System.out.println("The interest rate is:" + interestRate);
System.out.println("The loan amount is:" + loanAmount);
System.out.println("The term in years is:" + numberOfYears);
}
}
nanosani
Unauthenticated Liar
1,830 posts since Jul 2004
Reputation Points: 45
Solved Threads: 56
Start your own thread, do not hijack someone else's. Locking this thread now, as it is 6 years dead, anyhow.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494