Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,192 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,237 people online right now. Registration is fast and FREE... Join Now!




cs 101 mortgage calc

 
Reply to this topicStart new topic

cs 101 mortgage calc

capty99
post 6 Oct, 2008 - 06:44 PM
Post #1


the real kya

Group Icon
Joined: 26 Apr, 2001
Posts: 9,124



Thanked 15 times

Dream Kudos: 550
My Contributions


what did i do wrong. pretty sure its the formula

javascript

document.getElementById("MortgageCalc").addBtn.onclick = calcMonthly;
function calcMonthly()
{
var monthly_payment = "";
var elt = document.getElementById("MortgageCalc");
var P = parseFloat (elt.principal.value);
var R = parseFloat (elt.interest_rate.value);
var N = parseFloat (elt.term.value);
monthly_payment = P * R / (1-(1/(1+R))^N);
elt.monthly_payment.value = monthly_payment;
}

this is what i was given by the prof : R = P * r / (1 - (1 / (1 + r)n))


User is online!Profile CardPM

Go to the top of the page

Jayman
post 6 Oct, 2008 - 07:05 PM
Post #2


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,839



Thanked 38 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


Hmm.. I thought the formula was:

R = P * (r / (1 - (1 + r)^-n))
User is offlineProfile CardPM

Go to the top of the page

no2pencil
post 6 Oct, 2008 - 07:07 PM
Post #3


My fridge be runnin OH NOEZ!

Group Icon
Joined: 10 May, 2007
Posts: 6,328



Thanked 57 times

Dream Kudos: 2375

Expert In: Goofing Off

My Contributions


Is the buyout going to effect the formula?
User is online!Profile CardPM

Go to the top of the page

capty99
post 6 Oct, 2008 - 08:08 PM
Post #4


the real kya

Group Icon
Joined: 26 Apr, 2001
Posts: 9,124



Thanked 15 times

Dream Kudos: 550
My Contributions


QUOTE(jayman9 @ 6 Oct, 2008 - 10:05 PM) *

Hmm.. I thought the formula was:

R = P * (r / (1 - (1 + r)^-n))


the result of that is MORE right, but wrong.

at least its all positive ints as opposed to crazy negative numbers. eh.
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 04:41PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month