Mortgage Calculator

Amortization Table

Page 1 of 1

5 Replies - 1349 Views - Last Post: 13 December 2008 - 05:01 PM Rate Topic: -----

#1 PhillyDiva1982  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 09-December 08

Mortgage Calculator

Post icon  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?
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;


Is This A Good Question/Topic? 0
  • +

Replies To: Mortgage Calculator

#2 Programmist  Icon User is offline

  • CTO
  • member icon

Reputation: 252
  • View blog
  • Posts: 1,833
  • Joined: 02-January 06

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

Was This Post Helpful? 0
  • +
  • -

#3 Ostralis  Icon User is offline

  • #include <greeter>
  • member icon

Reputation: 9
  • View blog
  • Posts: 559
  • Joined: 13-December 08

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.
Was This Post Helpful? 0
  • +
  • -

#4 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Mortgage Calculator

Posted 13 December 2008 - 01:54 PM

View PostProgrammist, 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? :lol:

This post has been edited by Locke37: 13 December 2008 - 01:55 PM

Was This Post Helpful? 0
  • +
  • -

#5 Programmist  Icon User is offline

  • CTO
  • member icon

Reputation: 252
  • View blog
  • Posts: 1,833
  • Joined: 02-January 06

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

Was This Post Helpful? 0
  • +
  • -

#6 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

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. ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1