i need help with my code here is what I have

import java.util.*;
public class Payments
{
private double myLoan;
private double myInterest;
private double myPayment;
public void Payments()
{
Scanner pay = new Scanner(System.in);
System.out.print("Principal Loan = $");
myLoan = pay.nextDouble();
System.out.print("Annual Interest Rate(%) = ");
myInterest = pay.nextDouble();
System.out.print("Monthly Payment: ");
myPayment = pay.nextDouble();


int month = 0;
double balance = 0;
double total =  0;
do
{
System.out.println(" " + month);
month ++;


System.out.println(" " + myLoan);
myLoan = (0 + balance);


System.out.println(" " + myInterest);
myInterest = myLoan * myInterest;



System.out.println(" " + myPayment);
myPayment = myPayment;



System.out.println(" " + balance);
balance += myLoan + myInterest - myPayment;


}


while ( myPayment  < myLoan);
}
}


//System.out.println(" " + month);


//System.out.println(" " + myInterest);
//System.out.println(" " + myPayment);


/*System.out.printf("%5d", r*c);
System.out.println();
System.out.printf("%5f", "Month");
System.out.println(" " + month);
System.out.printf("%5f", "Principal Loan Amt.");
System.out.println(" " + myLoan);
System.out.printf("%5f", "Interest");
System.out.println(" " + myInterest);
System.out.printf("%5f","Payment");
System.out.println(" " + myPayment);
System.out.printf("%5f","New Balance");
System.out.println(" " + balance);*/


// total += myInterest * month;
//System.out.println("Total Interst Rate = " + total);

and heres the assignment:

Borrowing money for expensive items has become a way of life for most Americans. To illustrate the high cost of borrowing and how such loans work, you will be writing a class to calculate the following monthly analysis of a loan.

Month          Principal Loan Amt.               Interest 
(at 1%/month)          Payment           New Balance
1               10000.00                                   100.00                            300.00               9800.00
2                9800.00                                     98.00                             300.00               9598.00
3

many months later.....

39                     809.46                                        8.09                             300.00                517.55
40                     517.55                                        5.18                             300.00                222.73

Total: 2222.73

The loan analysis above started with the following information:

Principal (amount borrowed) =   10000.00
Annual Interest Rate =  12.0 %
Monthly Payment =   300.00

The monthly interest rate is found by dividing the annual rate among 12 months. For the above example the monthly rate is 1.0 %. The last three values of each line are calculated as follows:

Interest = Principal * Monthly Interest Rate
Payment = amount set at beginning of problem
New Balance = Principal + Interest - Payment

The new balance becomes the starting principal amount for the next month. As you can see, progress toward decreasing the principal is slow at the beginning of the loan.
Assignment:

Write a class to represent a loan as described above using the five-column format. Your class must accomplish the following:

  1. Data input: The class should ask for the appropriate starting information.

  2. Printing of analysis: The class must print the month-by-month analysis until the remaining principal is less than the monthly payment. At the bottom of the analysis you must print the total interest paid to the lending institution.

Could you post which part of your code you're having a problem with

Also wrap your codes in in code-tags

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.