Homework help

getting started with mortgage calculator

Page 1 of 1

13 Replies - 8291 Views - Last Post: 16 January 2008 - 06:29 PM Rate Topic: -----

#1 R6Chick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 13-January 08

Homework help

Post icon  Posted 13 January 2008 - 07:13 PM

I could really use a jumping off point or even something similar I could reverse engineer. I looked around the forum a bit but did not really catch on to anything. I am not even sure I have the first couple lines after the comment blocks correct. I had a very hard time with functions in Javascript so I suspect I will be losing my mind with Methods in Java as well.

Thx - JMP



/*
	Week 2 Individual Assignment
	PRG420 Java Programming I
	Due: Wednesday, January 16, 2008
	File Name: Week2Poulsen.java
*/

/*
	Write a Java program without a graphical user interface that
	calculates and displays the mortgage payment amount given
	the amount of the mortgage, the term of the mortgage, and the
	interest rate of the mortgage. In this program, hard code
	the amount = $200,000, the term = 30 years, and the interest
	rate = 5.75%. Insert comments in the program to document the
	program. Post your programs in your Learning Team forum for
	peer evaluation.
*/

public class Week2Poulsen.java
{
	public static void main()
	{




Is This A Good Question/Topic? 0
  • +

Replies To: Homework help

#2 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Homework help

Posted 13 January 2008 - 07:19 PM

Hello, the "code" you provided is a not an attempt, I see clearly that no effort has been shown on your side to solve the problem. So read the forum rules and I suggest that you go once again through the studying notes, books or whatever material you are learning from.
Was This Post Helpful? 0
  • +
  • -

#3 R6Chick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 13-January 08

Re: Homework help

Posted 13 January 2008 - 07:21 PM

View PostPennyBoki, on 13 Jan, 2008 - 07:19 PM, said:

Hello, the "code" you provided is a not an attempt, I see clearly that no effort has been shown on your side to solve the problem. So read the forum rules and I suggest that you go once again through the studying notes, books or whatever material you are learning from.



Wow, aren't you just the sweet one. I simply asked for a jumping off point and showed where I had started. I am no programmer and frankly never intend to be. Some of us have a harder time wrapping our wee little brains around this. Thanks for the warm welcome though.
Was This Post Helpful? 0
  • +
  • -

#4 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Homework help

Posted 13 January 2008 - 07:28 PM

View PostR6Chick, on 13 Jan, 2008 - 07:21 PM, said:

Wow, aren't you just the sweet one. I simply asked for a jumping off point and showed where I had started. I am no programmer and frankly never intend to be. Some of us have a harder time wrapping our wee little brains around this. Thanks for the warm welcome though.

That is all well but we cannot provide help unless the member shows effort. Those are the rules that all the members agree upon when they register. Believe me I did not intend to sound rude if I did then I apologize.
With all do respect PennyBoki.

This post has been edited by PennyBoki: 13 January 2008 - 07:35 PM

Was This Post Helpful? 0
  • +
  • -

#5 R6Chick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 13-January 08

Re: Homework help

Posted 13 January 2008 - 07:48 PM

View PostPennyBoki, on 13 Jan, 2008 - 07:28 PM, said:

That is all well but we cannot provide help unless the member shows effort. Those are the rules that all the members agree upon when they register. Believe me I did not intend to sound rude if I did then I apologize.
With all do respect PennyBoki.



Believe when I say effort went into that. I have read, re-read, and done some extra reading of the assigned materials. The more I read the less I understand. It starts to look more and more like greek to me. But thanks for thinking I did not even try. It's called being a beginner and for some it is harder than others. Congrats for being an expert. I had thought of hiring a tutor but it seems if you are not studying for SAT's or high school classes then there is nobody available.
Was This Post Helpful? 0
  • +
  • -

#6 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Homework help

Posted 13 January 2008 - 08:59 PM

OK, try to search this forum with the search engine on the side, and I am sure that you will find similar if not identical threads with assignments such as yours.
Was This Post Helpful? 0
  • +
  • -

#7 RodgerB  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 66
  • View blog
  • Posts: 2,284
  • Joined: 21-September 07

Re: Homework help

Posted 13 January 2008 - 09:25 PM

The bottom line is, you have no actual code to show. With that said, we will help you with your code, but its a little bit hard when your code is just two multi-line comments, the declaration of the java class and main entry point to the program (both of which aren't closed correctly, they should be encapsulated like so):

public class Week2Poulsen.java
{
	public static void main()
	{

	}
}



Show the code you are working on currently, working or not, and we will give you guidance as to whether you are on the right track or not (you should know this from any test conditions). :)
Was This Post Helpful? 0
  • +
  • -

#8 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: Homework help

Posted 14 January 2008 - 02:45 AM

I am pretty sure you can find dozens of mortgage calculators on this site to reverse engineer.
Also, I think Martyr2 has written even a tutorial in his blog about it.
So give that search box another try ;)

Also, next time please try to give your topic a name that helps people find it. This time I've changed it, so it gives some hint about it's content.
Was This Post Helpful? 0
  • +
  • -

#9 R6Chick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 13-January 08

Re: Homework help

Posted 15 January 2008 - 12:28 PM

never mind

This post has been edited by R6Chick: 15 January 2008 - 12:36 PM

Was This Post Helpful? 0
  • +
  • -

#10 R6Chick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 13-January 08

Re: Homework help

Posted 16 January 2008 - 02:10 AM

So I think I got it but the damn thing won't compile and no matter how hard I stare at it or how I move things around I can not get it to compile. Granted I have been trying to sort this out for so long I would miss the 800 pound gorilla in the room.

I am using TextPad to write for now. I don't think it is bright to use an IDE until this is not such a struggle. Otherwise I will never really understand it. YMMV

TIA - J

Compile Errors

E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:22: '{' expected
public class Week2Poulsen.java
^
E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:48: '}' expected
^
2 errors

Tool completed with exit code 1




/*
	Week 2 Individual Assignment
	PRG420 Java Programming I
	Due: Wednesday, January 16, 2008
	File Name: Week2Poulsen.java
*/

/*
	Write a Java program without a graphical user interface that calculates and
	displays the mortgage payment amount given the amount of the mortgage, the
	term of the mortgage, and the interest rate of the mortgage. In this program,
	hard code the amount = $200,000, the term = 30 years, and the interest rate
	= 5.75%. Insert comments in the program to document the program. Post your
	programs in your Learning Team forum for peer evaluation.
   
*/

import java.io.*;	//imports the io class

public class Week2Poulsen.java
{

	public int principal;			//declaring the amount variable
	public int months;				//declaring the time variable
	public float interest;			//declaring the interest variable

	public static void main(String[] args) throws IOException
	{
		int payment;
		principal=200000;			//hard code: define the principal
		months=360;					//hard code: define the months
		interest=.0575;				//hard code: define the interest

		//Arithmetical equations

		payment = (principal*(interest/12)) / (1 - 1 /Math.pow((1 + interest/12), months));

		//Display the loan information and monthly payment

		System.out.println("The principal of the loan is $200,000");
		System.out.println("The length of the loan is 30 years");
		System.out.println("The interest on the loan is 5.75%");
		System.out.println("The monthly payment is " + payment);
	}
}




Was This Post Helpful? 0
  • +
  • -

#11 R6Chick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 13-January 08

Re: Homework help

Posted 16 January 2008 - 02:01 PM

Errors:
E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:32: non-static variable principal cannot be referenced from a static context

principal=200000; //hard code: define the principal
^
E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:33: non-static variable months cannot be referenced from a static context

months=360; //hard code: define the months
^
E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:34: non-static variable interest cannot be referenced from a static context

interest=.0575; //hard code: define the interest
^
E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:34: possible loss of precision
found : double
required: float

interest=.0575; //hard code: define the interest
^
E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:38: non-static variable principal cannot be referenced from a static context

payment = (principal*(interest/12)) / (1 - 1 /Math.pow((1 + interest/12), months));
^
E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:38: non-static variable interest cannot be referenced from a static context

payment = (principal*(interest/12)) / (1 - 1 /Math.pow((1 + interest/12), months));
^
E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:38: non-static variable interest cannot be referenced from a static context

payment = (principal*(interest/12)) / (1 - 1 /Math.pow((1 + interest/12), months));
^
E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:38: non-static variable months cannot be referenced from a static context

payment = (principal*(interest/12)) / (1 - 1 /Math.pow((1 + interest/12), months));
^
E:\Documents\Courses\PRG420\Individual Assignment\Week 2\Week2Poulsen.java:38: possible loss of precision
found : double
required: int

payment = (principal*(interest/12)) / (1 - 1 /Math.pow((1 + interest/12), months));
^
9 errors

Tool completed with exit code 1



import java.io.*;	//imports the io class

public class Week2Poulsen

{

	public int principal;			//declaring the amount variable
	public int months;				//declaring the time variable
	public float interest;			//declaring the interest variable

	public static void main(String[] args) throws IOException
	{
		int payment;
		principal=200000;			//hard code: define the principal
		months=360;					//hard code: define the months
		interest=.0575;				//hard code: define the interest

		//Arithmetical equations

		payment = (principal*(interest/12)) / (1 - 1 /Math.pow((1 + interest/12), months));

		//Display monthly payment

		System.out.println("The principal of the loan is $200,000");
		System.out.println("The length of the loan is 30 years");
		System.out.println ("The interest on the loan is 5.75%");
		System.out.println("The monthly payment is " + payment);
	}
}




Was This Post Helpful? 0
  • +
  • -

#12 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Homework help

Posted 16 January 2008 - 02:44 PM

I made minor corrections it should compile now.


import java.io.*;	//imports the io class

public class Week2Poulsen

{

				//declaring the interest variable

	public static void main(String[] args) throws IOException
	{
		int principal;			//declaring the amount variable
		int months;				//declaring the time variable
		double interest;
		double payment;
		principal=200000;			//hard code: define the principal
		months=360;					//hard code: define the months
		interest=0.0575;				//hard code: define the interest

		//Arithmetical equations

		payment = (principal*(interest/12.0)) / (1 - 1 /Math.pow((1 + interest/12.0), months));

		//Display monthly payment

		System.out.println("The principal of the loan is $200,000");
		System.out.println("The length of the loan is 30 years");
		System.out.println ("The interest on the loan is 5.75%");
		System.out.println("The monthly payment is " + payment);
	}
}


Was This Post Helpful? 0
  • +
  • -

#13 R6Chick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 13-January 08

Re: Homework help

Posted 16 January 2008 - 03:08 PM

Thanks for the help. I think I may have sorted it on my own after some more Dr. Pepper infused into my blood. It compiled and appears to do as it should. Do you see anything I should change?




import java.io.*;	//imports the io class

public class Week2Poulsen
{

	public int principal;			//declaring the amount variable
	public int months;				//declaring the time variable
	public float interest;			//declaring the interest variable

	public static void main(String[] args) throws IOException
	{
		double payment;
		int principal=200000;			//hard code: define the principal
		int months=360;					//hard code: define the months
		double interest=.0575;				//hard code: define the interest

		//Arithmetical equations

		payment = (principal*(interest/12)) / (1 - 1 /Math.pow((1 + interest/12), months));

		//Display monthly payment

		System.out.println("\t\t*************************************");
		System.out.println();
		System.out.println("\t\tThe principal of the loan is $200,000");
		System.out.println("\t\tThe length of the loan is 30 years");
		System.out.println("\t\tThe interest on the loan is 5.75%");
		System.out.println("\t\tThe monthly payment is " + payment);
		System.out.println();
		System.out.println("\t\t*************************************");
	}
}




Was This Post Helpful? 0
  • +
  • -

#14 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Homework help

Posted 16 January 2008 - 06:29 PM

principal, months and interest are declared twice. I don't think there is a need for that.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1