473,325 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Passing Information to a Method or a Constructor problem

10
following is a method that computes the monthly payments for a home loan, based on the amount of the loan, the interest rate, the length of the loan (the number of periods), and the future value of the loan:

Expand|Select|Wrap|Line Numbers
  1. public double computePayment(double loanAmt,
  2. double rate,
  3. double futureValue,
  4. int numPeriods) {
  5.         double interest = rate / 100.0;
  6.         double partial1 = Math.pow((1 + interest), -numPeriods);
  7.         double denominator = (1 - partial1) / interest;
  8.         double answer = (-loanAmt / denominator)
  9.                         - ((futureValue * partial1) / denominator);
  10.         return answer;
  11. }
Q:1 - What does Math.pow compute?

Q:2- I have not understood the computation part?
Expand|Select|Wrap|Line Numbers
  1. double interest = rate / 100.0;
  2. double partial1 = Math.pow((1 + interest), -numPeriods);
  3. double denominator = (1 - partial1) / interest;
  4. double answer = (-loanAmt / denominator)
  5.                 - ((futureValue * partial1) / denominator);
  6. return answer;
Can you please help me out.
Sep 16 '08 #1
3 1102
JosAH
11,448 Expert 8TB
A.1. Math.pow(x, y) computes x raised to the power y.
A.2. What doesn't work as you expected it to work?

kind regards,

Jos
Sep 16 '08 #2
Nepomuk
3,112 Expert 2GB
Hi Vneha!

As you seemingly didn't see it in your other thread, I'll write it out clearly here: Please use the [CODE] ... [/code] tags, when posting code. I've added them in both of your threads now.

Now, to your questions. Math.pow calculates the value of the first argument raised to the power of the second argument. (from the java api)

The calculations there are actually quite simple - try doing them on paper and then you should understand.

Greetings,
Nepomuk (Moderator)
Sep 16 '08 #3
Vneha
10
Thanks,

I got it.

Regards,

Neha
Sep 17 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Guy | last post by:
Hi, I'm working in vb.net and have one form that creates a second form. I need the first form pass info to the second form. I tried using a shared property in the first form and got this error...
13
by: Abe Frohnman | last post by:
Hello all, I'm passing a reference to a class into the constructor of a form, like so: public MyForm(int count, ref Area myArea) {...} How can I use myArea outside the constructor? Should I...
7
by: Ken Allen | last post by:
I have a .net client/server application using remoting, and I cannot get the custom exception class to pass from the server to the client. The custom exception is derived from ApplicationException...
4
by: thawk | last post by:
I have tried to pass information from one form to another using the described method in the documentation, but everytime I attempt to do this I get an error message that states that I have a null...
6
by: ged | last post by:
Hi, i am a oo (c#) programmer, and have not used javascript for a while and i cant work out how javascript manages its references. Object References work for simple stuff, but once i have an...
32
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is...
4
by: ingoweiss | last post by:
Hi, I am having trouble passing parameters of a Javascript subclass constructor through to it's superclass constructor. I am trying all sorts of things, including the below, but nothing...
7
by: AMP | last post by:
Hello, I have this in form1: namespace Pass { public partial class Form1 : Form { public Form2 form2; public Form1() {
2
by: John Lutz | last post by:
Our app is mainly COM based. We allow .NET plug-ins. When a plug-in is installed, it receives a COM pointer to the app. The plug-in implements our IExtensionImpl interface and gets the app...
6
by: raylopez99 | last post by:
This thread is about how variables or parameters (including objects) are passed between forms (namely, using parameterized constructors, e.g., to pass an int between forms (e.g., a calling form and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.