Link to home
Start Free TrialLog in
Avatar of Helenthejewel
Helenthejewel

asked on

Mortgage calculation in java programming language

$200,000 loan amount
5.75% interest rate
30 year term
Avatar of Helenthejewel
Helenthejewel

ASKER

<email removed by mlmcc PE>>I do appreciate the help.
write some pusedo code or attempt to write some code here and I'll help you. I cant write the progrm because it sounds like homeork
import java.awt.*;
 Class Mortgage  {
  public static void main (String[] args)  {
 static int years = 30;  
 static double amount = 200000;  
 static double rate = 5.75;    
 
  //My first attempt to write a Java program
 }    
  {"I'm in main", "My
             mortgage amount has been hard-coded..."
 {
 {
 mortgage_amount= $200,000;
 }
 //No down payment The monthly factor
 function set_interest(5.75)  System out.printin(.0575/12);
  {
 interest_rate=form.interest_rate.value;
 }
 {
 function set_term(30 years)  System out.printin(360*12);
 }
 {term=form.term.value; System out.printn(200,000*0.0048)
  }
SOLUTION
Avatar of Jase-Coder
Jase-Coder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have been working with it day and night.  I am using JProPro.  So far I have revised to the following point:  Please check
import java.math.*;
import java.text.*;
import java.util.*;


public class mortgage{
   
 static NumberFormat n = NumberFormat.getCurrencyInstance();

    static int yterm = 30;            // Variable for length of term in years
    static double price = 200000;    // Variable for total amount of mortgage
    static double rate = 5.75;        // Variable for interest rate
    static double mrate = rate/100;
    static double payment = price*((mrate)/(12)+((mrate)/(12))/(Math.pow((1+(mrate)/12),(yterm*12))-1));
                               
                               
  public static void main(String[] args) throws Exception {

       
       
    int term = 360;
    double interestDue, amtApplied;      

   while (term > 0) {
      if(term == 300)
      break;
        interestDue = (price * (rate/100)) / 12;
        amtApplied = payment - interestDue;
        price = price - amtApplied;
       


System.out.println("Payment # "  + term
            + "  Principle=" + n.format(amtApplied)
            + "  Interest=" + n.format(interestDue)
            + "  Balanace=" + n.format(price));
        --term;
    return --term;
 }
   

   while (term > 0) {
      if(term == 240)
      break;
        interestDue = (price * (rate/100)) / 12;
        amtApplied = payment - interestDue;
        price = price - amtApplied;
       


System.out.println("Payment # "  + term
            + "  Principle=" + n.format(amtApplied)
            + "  Interest=" + n.format(interestDue)
            + "  Balanace=" + n.format(price));
        --term;
   
 }
In your example:  I received the following error:

File "C:\WINDOWS\Temporary Internet Files\Content.IE5\BZGXQZIA\java24.java" Line 1: Syntax Error
In the second version, I could not get it to compile can you reaccess that version Please!
Can you explain what exactly you are calculating and how you need to calculate it. It is hard to know if you are doing it correctly unless we know exactly what you need to do.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wim ten Brink
Ehm, if this question gets closed and the other question in this topic area too then there are no more open questions in this topic area anymore. How can we, experts, earn any points if there just aren't any questions anymore? ;-)

Oh, just close it. No objections here. I'm just nagging a bit since this topic area seems dead and buried by now. :-(
I understand the frustration.  It is EE policy to close questions that don't have recent comments in them.  I think you will find that many Pascal questions are school or training related and once an answer is received they may or may not get closed.

Keep an eye on the TA it may get more questions.  If you look at the answered questions you will notice there is a lag between questions.

mlmcc