please help resolve some error messages code is compling with errors
see below the code. I am new at this please help!
/**
* @(#)3 Mortgage loans.java
*
* 3 Mortgage loans application
*
* Phyllis J Jones
* Purpose to write a program in Java without a graphical user interface and have
it calculate the payment amount for 3 mortgage loans.
*/
import java.math.*;//*loan calculator
import java.text.*;//*formats numbers
public class MortgageLoans {
// declare class variable array
double mortgage calculator1[];
double mortgage calculator2[];
double mortgage calculator3[];
//construct the array
mortgage calculator1 = new double[6];
mortgage calculator2 = new double[6];
mortgage calculator3 = new double[6];
double loan = 200000
double term1 =360//*360 month for 30 year mortgage
double interRate1 = 0.0575; //*5.75% 5.75/100interest rate 30year mortgage
double monthlyRate1 = (interestRate1/12)
double term2 = 84//*7year mortgage loan
double interestRate2 = 0.0535;//*5.35 5.35/100 interest rate 7 year mortgage
double monthlyRate2 = (interestRate2/12);//*rate calculation on 7 year mortgage loan
double term3 = 180 // 15 year mortgage
double interestRate3 = 0.0550;//*5.5 5.5/100 interest rate on 15 year mortgage
double monthlyRate3 = (interestRate3/12);//* monthlyRate for 15 year mortgage
//Discount factr calculator for the three loans
double discountFactor1 = (Math.pow ((1 + monthlyRate1),
term1)-1/(monthlyRate1 * Math.pow((1 + monthlyRate1),term1));
double discountFactor2 = (Math.pow((1 + monthlyRate2),term2)-1/
(monthlyRate2* Math.pow((1 + monthlyRate2),term2));
double discountFactor3 = (Math.pow((1 + monthlyRate3), term3) - 1)/
(monthlyRate3 * Math.pow((1 + monthlyRate3), term3));
double payment1 = loan/discountFactor1; //*Rate Calcualtion for 30 yearn mortgage
double payment2 = loan/discountFactor2; //*Rate Calculaion for 7 year morgage
double payment3 = loan/discountFactor3; //*Rate Clculation for 15 year mortgage
//loop While not done
while(loan > 0)
{
java.text.DecimalFormat dfm = new java.text.DecimalFormat(",###.00");
System.out.println("Your monthly payment is $" + dfm.format(payment)+ "cemts");
// loop while done
if(loan>0)
{
double payment1 = loan/discountFactor1;//*Rate Calculation
double payment2 = loan/discountFactor2;//*Rate Calculation
double payment3 = loan/duiscountFactor3;//*Rate Calculation
}
else
payment1 = payment/discountFactor1;//Rate Calculation
payment2 = payment/discountFactor2;//Rate Calcuklation
payment3 = payment/discountfactor3;//Rate Calculation
}
//Output
}
}
1 9786
fixed a few errors - what is now missing is the variable payment -
/**
-
* @(#)3 Mortgage loans.java
-
*
-
* 3 Mortgage loans application
-
*
-
* Phyllis J Jones
-
* Purpose to write a program in Java without a graphical user interface and have
-
it calculate the payment amount for 3 mortgage loans.
-
*/
-
import java.math.*;//*loan calculator
-
import java.text.*;//*formats numbers
-
public class MortgageLoans {
-
-
public static void main(String args[]) // ** added
-
{
-
-
-
// declare class variable array
-
double mortgageCalculator1[] = new double[6]; // ** new added ;
-
double mortgageCalculator2[] = new double[6];
-
double mortgageCalculator3[] = new double[6];
-
//construct the array
-
//mortgageCalculator1 = new double[6];
-
//mortgageCalculator2 = new double[6];
-
//mortgageCalculator3 = new double[6];
-
-
-
double loan = 200000; // ** add ;
-
double term1 =360;//*360 month for 30 year mortgage
-
double interestRate1 = 0.0575; //*5.75% 5.75/100interest rate 30year mortgage
-
double monthlyRate1 = (interestRate1/12); // ** ; added
-
double term2 = 84;//*7year mortgage loan
-
double interestRate2 = 0.0535;//*5.35 5.35/100 interest rate 7 year mortgage
-
double monthlyRate2 = (interestRate2/12);//*rate calculation on 7 year mortgage loan
-
double term3 = 180; // 15 year mortgage
-
double interestRate3 = 0.0550;//*5.5 5.5/100 interest rate on 15 year mortgage
-
double monthlyRate3 = (interestRate3/12);//* monthlyRate for 15 year mortgage
-
-
//Discount factr calculator for the three loans
-
double discountFactor1 = (Math.pow ((1 + monthlyRate1),term1)-1/(monthlyRate1 * Math.pow((1 + monthlyRate1),term1))); // ** added )
-
-
double discountFactor2 = (Math.pow((1 + monthlyRate2),term2)-1/(monthlyRate2* Math.pow((1 + monthlyRate2),term2))); // ** added )
-
-
double discountFactor3 = (Math.pow((1 + monthlyRate3), term3) - 1)/(monthlyRate3 * Math.pow((1 + monthlyRate3), term3));
-
-
double payment1 = loan/discountFactor1; //*Rate Calcualtion for 30 yearn mortgage
-
double payment2 = loan/discountFactor2; //*Rate Calculaion for 7 year morgage
-
double payment3 = loan/discountFactor3; //*Rate Clculation for 15 year mortgage
-
-
-
//loop While not done
-
while(loan > 0)
-
{
-
-
java.text.DecimalFormat dfm = new java.text.DecimalFormat(",###.00");
-
System.out.println("Your monthly payment is $" + dfm.format(payment)+ "cemts");
-
// loop while done
-
if(loan>0)
-
{
-
payment1 = loan/discountFactor1;//*Rate Calculation
-
payment2 = loan/discountFactor2;//*Rate Calculation
-
payment3 = loan/discountFactor3;//*Rate Calculation
-
}
-
else
-
payment1 = payment/discountFactor1;//Rate Calculation
-
payment2 = payment/discountFactor2;//Rate Calcuklation
-
payment3 = payment/discountFactor3;//Rate Calculation
-
}
-
//Output
-
-
}
-
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: promiscuoustx |
last post by:
I am trying to get my program to compile, but it will not complete. At line 79 it states, cannot convert 'float()()' to 'float' in assignment. Here is my code.
#include <iostream>
#include...
|
by: phjones |
last post by:
Need help programming mortagage calculator for 3 different loans 7 year, 15 year and 30 year. using java array I am a beginner with Java, This is what I have so far. Need to know if I am off the...
|
by: phjones |
last post by:
This is not a class project.The program below is to display mortgage interest paid for each payment over the term of the loan and loan balance.It is program using array. However, I am receiving the...
|
by: dylbin |
last post by:
I am having trouble with the following program:
Without using a G.U.I., using a loan amount of $200,000 with an interest rate of 5.75% and a 30 year term, I have to display the mortgage payment...
|
by: zaidalin79 |
last post by:
I have finally gotten my GUI to look like I want it to, but I am having trouble getting the calculations right. No matter what I put in there, it seems to calculate a large payment, and a very wrong...
|
by: LadiPrather |
last post by:
When I press the 7 year with 5.35% the amort table goes across the screen instead of down. When I press the 30 year with 5.75% it exit the program. I cannot figure out what I did wrong, will someone...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |