| | |
while loop!!!! dont know how to do it???
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Apr 2009
Posts: 11
Reputation:
Solved Threads: 0
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.
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.
While loop with checking if expression is valid
Do-while, will run at least once so make sure it has something to process and doesn't give you any Exceptions
Java Syntax (Toggle Plain Text)
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
Java Syntax (Toggle Plain Text)
int i = 10; do{ i--; }while(i > 0);
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
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 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.
![]() |
Similar Threads
- Loop counting odd and even numbers (C++)
- cannot start up XP - stuck in restart loop, keyboard frozen (Windows NT / 2000 / XP)
- factorial using a for loop (C++)
- The for loop programming style? (C)
- while loop dont seem to work (C++)
- if-statement executes each Loop ? (C++)
- do while loop with pointers (C++)
- total tech virgin seeks geeks help (IT Professionals' Lounge)
- I need to re-write this code using a 'while' loop. (Java)
- Please Check The Errors'..Dont know what else to do (C++)
Other Threads in the Java Forum
- Previous Thread: Dice rolls bar graph
- Next Thread: Constructor with Images and Audio
| Thread Tools | Search this Thread |
-xlint android api applet application array arrays automation bi binary blackberry block bluetooth chat class classes client code compile compiler component database developmenthelp draw eclipse error event exception fractal freeze game gameprogramming givemetehcodez graphics gui html ide image input integer j2me j2seprojects java javac javaprojects jetbrains jni jpanel jtable julia learningresources lego linux list login loop loops mac map method methods mobile netbeans newbie notdisplaying number online oracle page print problem program programming project qt recursion scanner screen server set singleton size sms sort sql string swing system template textfields threads time title tree tutorial-sample update variablebinding windows working xor






