public class Week4_Mortgage {
public static void main(String []args)
{
//declare variables
double RateofLoan;
double TermofLoan;
double AmountofMortgage;
double MonthlyPayment;
Scanner input = new Scanner(System.in);
int userChoice = input.nextInt(); // returns the next integer
//Display decimal point format
DecimalFormat decimalPlaces=new DecimalFormat("0.00");
//Prompt user to choose the method to calculate the mortgage
Scanner input = new Scanner(System.in);
int userChoice = 0;
do {
System.out.printIn("Please choose the method to use for the mortgage calculation");
userChoice = input.nextInt();
}
while(userChoice != 1 && userChoice != 2);
if (userChoice) == 1) {
//Display the first method
MonthlyPayment = (AmountofMortgage * InterestofLoan) / (1 - Math.pow(1 + InterestofLoan - TermofLoan));
}
else if (userChoice == 2) {
//Display the second method
MonthlyPayment = MonthlyPayment (InterestofLoan / (1 - Math.pow(1 + InterestofLoan) * - TermofLoan));
}
//Display calculation used for the mortgage calculation
MonthlyPayment = (AmountofMortgage * InterestofLoan) / (1 - Math.pow(1 + InterestofLoan - TermofLoan));
//Display the amount of each loan
TotalofLoan=JOptionPane.showInputDialog(null, "Enter the Amount of each Loan");
AmountofLoan = Double.parseDouble(TotalofLoan);
//Display interest rate
InterestofLoan=JOptionPane.showInputDialog(null, "Enter the Interest Rate in decimals");
LoanInterest = Double.parse.Double(InterestofLoan)*12;
//End of display interest rate
//Display loan term
MortgageTerm=JOptionPane.showInputDialog(null, "Enter the term of each loan");
TermofLoan = Integer.parseInt(MortgageTerm)*12;
Mortgage CalculatorAmortization Table
Page 1 of 1
5 Replies - 1183 Views - Last Post: 13 December 2008 - 05:01 PM
#1
Mortgage Calculator
Posted 12 December 2008 - 06:11 PM
What statement would be good for making a loan amortization table? Did I do this right so far?
Replies To: Mortgage Calculator
#2
Re: Mortgage Calculator
Posted 13 December 2008 - 01:26 PM
This is probably the most common problem given to students every semester. Search this site for "mortgage calculator" and you'll see several threads to chose from.
This post has been edited by Programmist: 13 December 2008 - 01:26 PM
#3
Re: Mortgage Calculator
Posted 13 December 2008 - 01:40 PM
So far looks pretty good. As Programmist said, there's probably a million topics like this.
As for your question, I just recently did this.
I created methods that determine the Loan and stuff, like getLoan(), etc., stuff like that.
Then, I called those methods in a voidmainstringarg, with utilization of the Scanner (I think thats java.util.* library).
So, I did mine differently, but what you have looks good so far.
As for your question, I just recently did this.
I created methods that determine the Loan and stuff, like getLoan(), etc., stuff like that.
Then, I called those methods in a voidmainstringarg, with utilization of the Scanner (I think thats java.util.* library).
So, I did mine differently, but what you have looks good so far.
#4
Re: Mortgage Calculator
Posted 13 December 2008 - 01:54 PM
Programmist, on 13 Dec, 2008 - 12:26 PM, said:
This is probably the most common problem given to students every semester. Search this site for "mortgage calculator" and you'll see several threads to chose from.
The drinking game has begun!
What kind of liquor?
This post has been edited by Locke37: 13 December 2008 - 01:55 PM
#5
Re: Mortgage Calculator
Posted 13 December 2008 - 02:56 PM
Damn. I guess I did say that I'd take a sip everytime someone said "mortgage calculator."
This post has been edited by Programmist: 13 December 2008 - 02:56 PM
#6
Re: Mortgage Calculator
Posted 13 December 2008 - 05:01 PM
Ah, but you did say the beginning of each semester. And as far as I know, it's the end of the semester for most people.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote






|