Hi I am new to Java and have no clue what I am doing and I think my book is confusing me more than it is helping me. Here is what I need to do. Write the program in Java (without a graphical user interface) using a loan amount of $200,000 with an interest rate of 5.75% and a 30 year term. Display the mortgage payment amount and then list the loan balance and interest paid for each payment over the term of the loan. If the list would scroll off the screen, use loops to display a partial list, hesitate, and then display more of the list. I know that I am supposed to create a loop but I have no clue how to do this correctly or even if the math portion of it is correct. I need some guidance please and also please try to tell me in a way that I can understand. And try not to laugh to much at my code lol. Here is what I have attempted so far:
public class MortgageCalculator {
private static double interest;
public static void main(String[] args) {
double annualInterest = 5.75; //This is the annual interest rate
double loanAmount = 200000; //This is the loan amount
double loanLengthInYears = 30; //This is the length of the loan in years
//Formuals bieng used are:
double monthlyInterest = annualInterest /100/12;
double loanLengthInMonths = loanLengthInYears * 12;
double monthlyPayment = (loanAmount * monthlyInterest) / (1 - Math.pow((1 + monthlyInterest), -loanLengthInMonths));
DecimalFormat decimalPlaces=new DecimalFormat("0.00");//Rounds up the dollar amount
System.out.println("MortgageCalculator");
System.out.println("Annual Interest: 5.75%");
System.out.println("Loan Amount: $200,000");
System.out.println("Loan Length: 30 years");
System.out.println("Monthly Payment: " + decimalPlaces.format(monthlyPayment));
double currentLoanAmount;
currentLoanAmount = loanAmount;
while (currentLoanAmount >= 0.10)
double interestPayment;
interestPayment = (currentLoanAmount * monthlyInterest);
double currentLoanAmount = currentLoanAmount - (monthlyPayment - interestPayment)
System.out.println("loanAmount");
System.out.println("Interest Payment");
}
}