Why are you making fun of me ?
Main Topics
Browse All TopicsCould you give a brief explanation to the areas where you see // ??? Thank you and here is my program.
public static void main(String[] args)
{
DecimalFormat twoDigits = new DecimalFormat("$###,###.00
double mortgage = 200000.00;
double[][] yearsYearlyRate = //Multiplies term by interest rate
{
{ 7, 15, 30 },
{ 5.35, 5.5, 5.75 }
};
double[][] monthsMonthlyRt =
{
{
yearsYearlyRate[0][0] * 12, yearsYearlyRate[0][1] * 12,
yearsYearlyRate[0][2] * 12
},
{
yearsYearlyRate[1][0] / 1200, yearsYearlyRate[1][1] / 1200,
yearsYearlyRate[1][2] / 1200
}
};
for (int i = 0; i < 3; i++) // brief descriotion please of what this means
{
// ??? Please help here
double payment = calPayment(monthsMonthlyRt
System.out.println("\nMort
System.out.println("$200,0
+ yearsYearlyRate[1][i] + "%\t\t" + twoDigits.format(payment))
System.out.println("\nPaym
interestBalanceList(mortga
}
}
// I totally do not understand what this entire double tmp or param thing means. Please help !!!
public static double calPayment(double param1, double param2, double mortgage) {
double tmp = 1 + ( param1 ) ;
for ( int i = 1 ; i < param2 ; i++)
tmp = tmp * ( 1 + param1 ) ;
double monthlyPayment = mortgage * tmp * param1 / ( tmp - 1 ) ;
// double monthlyPayment = (param1 + param2 / (Math.pow((1 + param1), param2) - 1)) * mortgage;
return monthlyPayment;
}
public static void interestBalanceList(double
double payment)
{
for (int i = 1; i < (param2 + 1); i++) // Provide brief description please
{
System.out.println("Press 'ENTER' to view the loan amortization.");
try
{
System.in.read();
} catch (Exception e) // what will the catch portion do ?????
{
}
// Calculate the Monthly Interest of the Loan Balance
double monthlyInterest = mortgage * param1;
// Calculate the Remaining Loan Balance
double loanRemaining = mortgage - (payment - monthlyInterest);
// Set the value of Mortgage Amount to the Value of the Remaining Loan Balance
mortgage = loanRemaining;
// Format the Monthly Interest Amount into U.S. Currency
NumberFormat n = NumberFormat.getCurrencyIn
String str = n.format(monthlyInterest);
// Format the Remaining Loan Balance into U.S. Currency
NumberFormat num = NumberFormat.getCurrencyIn
String string = num.format(loanRemaining);
System.out.println("\n " + i + "\t\t\t" + str + "\t\t\t" + string); // Please explain the string ???????
}
} // Also, I would like to make the program pause after showing 12 payments on the screen so
// how would I go about doing this ?????
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
> try
>
> {
> System.in.read();
Here are my comments/suggestions:
> } catch (Exception e) // what will the catch portion do ?????
>
>
> {
>
> }
you should catch IOException (NOT Exception) - best way to throw it out (failure to read from System.in is critical). So the signature of method interestBalanceList would change to
public static void interestBalanceList(double
double payment) throws IOException
Grab a tutorial and start reading:
http://java.sun.com/javase
http://java.sun.com/docs/b
>>> for (int i = 0; i < 3; i++) // run the block following from { to } 3 times, with i valueing 0, 1 and 2
>>> double[][] yearsYearlyRate // a two dimensional array; see it as:
[0] [1] [2]
+----------+------------+-
[0] | 7 | 15 | 30 |
+----------+------------+-
[1] | 5.35 | 5.5 | 5.75 |
+----------+------------+-
>>> double payment = calPayment(monthsMonthlyRt
calls 'calPayment()' (see below) with 3 parameters, drawn from the 2-dimensional array and the variable 'mortgage'.
>>> public static double calPayment(double param1, double param2, double mortgage) {
Here comes every call to this method with those 3 variables filled as above.
It concerns 3 copied values, so you can use them at will.
the return value is passed to the caller.
The variables 'tmp', 'i' and 'monthlyPayment' are local workfields to this method.
I could go on explaining every statement, but:
1) this program computes the monthly payment for a given mortgage.
If you don't know what that is, stop programming and learn about that first.
2) besides you should take a quick course to understand and read JAVA,
otherwise you can't do anything with this program.
I recommend: http://java.sun.com/javase
;JOOP!
Business Accounts
Answer for Membership
by: expertmbPosted on 2006-08-01 at 23:27:51ID: 17230725
http://www.laymansterms.ne t/