Welcome to Dream.In.Code
Become a Java Expert!

Join 149,835 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,513 people online right now. Registration is fast and FREE... Join Now!




Java Loop for a balance & interest loan

 
Reply to this topicStart new topic

Java Loop for a balance & interest loan, Help to build the loop & make the program run by tomorrow

dolphins-1@hotmail.com
18 Feb, 2007 - 06:34 PM
Post #1

New D.I.C Head
*

Joined: 18 Feb, 2007
Posts: 3


My Contributions
crazy.gif I'm going crazy trying to build a loop to display the list of loan balance and interest of each payment over the loan term (30 yrs).


Here is the code, Please somebody help!!! I need to post tomorrow, it will be perfect if I can check it out after non, I have to finish the flowchart for it.. Any help is greatly appreciated...

/*Purpose: Change Request #1- Display mortgage payment amount and then list loan balance and interest paid for each payment over the loan term.
Date: February 17, 2007
Version 1.0
*/

import java.Math.*;
import java.text.*;
import java.text.DecimalFormat;


public class MortgageLoanBal
{

// The "throws Exception" statement at the end allows the program to continue
// to run when encounters an error

public static void main(String[] args)throws Exception
{
// I would use the number formatter Alex Cook recommended too

java.text.NumberFormat money = java.text.NumberFormat.getCurrencyInstance();

/* Defining Variables */
double mlprincipal = 200000.00;
double mlinterestrate = 5.75;
int mlyears = 30;

//Process Monthly Payment
double mlPayment = mlMortgageLoanBal.getMortgageLoanBal(mlprincipal,, mlinterestrate/12, mlyears*12);
int LineCount = 1;
double monthlyinterest = 0;
double monthlyinterest = annualinterest/12;

// Display Beginning Balance
System.out.println("Beginning Balance = " + money.format(mlprincipal));
while (LoanBalance > 0.01)
{

//Process & Display New Loan Balances
mlmonthlyinterest = mlprincipal*mlmonthlyinterest;
mlprincipal = mlprincipal+mlmonthlyinterest-mlpayment;
system.out.println(money.format(mlprincipal));

//Display Message to Continue on Next Page
if (LineCount > 12)
{
System.out.println("Press Enter to View Next Page");
}
else
{
LineCount = LineCount+1;
}
}
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Java Loop For A Balance & Interest Loan
20 Feb, 2007 - 02:28 PM
Post #2

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,869



Thanked: 53 times
Dream Kudos: 550
My Contributions
Well the code posted is not complete. If you put the code into [ code ] tags it is easier to read. What exatly is your question? If this code does not work, what does it do wrong? I can't run the code because I don't have the class mlMortgageLoanBal.

This post has been edited by NickDMax: 20 Feb, 2007 - 02:34 PM
User is offlineProfile CardPM
+Quote Post

dolphins-1@hotmail.com
RE: Java Loop For A Balance & Interest Loan
20 Feb, 2007 - 04:39 PM
Post #3

New D.I.C Head
*

Joined: 18 Feb, 2007
Posts: 3


My Contributions
QUOTE(NickDMax @ 20 Feb, 2007 - 03:28 PM) *

Well the code posted is not complete. If you put the code into [ code ] tags it is easier to read. What exatly is your question? If this code does not work, what does it do wrong? I can't run the code because I don't have the class mlMortgageLoanBal.

NickDMax:

Thanks, that's all I had then. I fixed and completed the code. I had to posted back as an assigment no later than 2/19/07 12:00M.

Thank you,

User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Java Loop For A Balance & Interest Loan
20 Feb, 2007 - 05:00 PM
Post #4

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,869



Thanked: 53 times
Dream Kudos: 550
My Contributions
Funny hoe people always ask for help at the last moment. I guess that is when you really need help the most. Sorry I could not help more.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 09:39AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month