i am stuk on this and have a[solutly no idea in how to create the while loop!!!

could someone please show me how to do this???

Write a Java application that calculates the number of repayments for a loan based on the initial loan amount, annual interest rate and monthly payment. The user enters these values and application uses a loop to display the balance each month after payment has been made. Note that interest is charged each month on the remaining balance.

For this exercise, you need to use a while loop that repeats as long as the balance is greater than zero to calculate the new balance with interest after each payment. The body of the loop calculates the new balance plus monthly interest (monthly interest = annual interest rate / 12) and then subtracts the payment. Note that it may be possible for the last payment to be less than the usual monthly payment. In this case you need to take this into account by only subtracting the amount necessary to clear the outstanding balance and not the full monthly payment.

Below is an example of how a user would interact with the application, use this as a guide when designing the input and output of your application.

Recommended Answers

All 5 Replies

can you post your code that you have already written.

thats wah i mean i dnt knw hw 2 start it

While loop with checking if expression is valid

int i = 0;
while( i < 10){
    i++;
}

Do-while, will run at least once so make sure it has something to process and doesn't give you any Exceptions

int i = 10;
do{
    i--;
}while(i > 0);

thats wah i mean i dnt knw hw 2 start it

Drop the lazy "chat speak". Read the forum rules regarding posting in proper English.
This is about the fourth homework assignment that you have posted verbatim without showing any effort or even a thought on the matter. This is not a homework completion service. Post your code and ask specific questions if you want help with something.

This is not a homework completion service.

It depends. If he posts it in the 'paid projects' section it will quickly become one. ;)

commented: Good idea, where did I out details to my PayPal ;) +17
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.