Friday, August 8, 2014

NGTC CIS Work Study Position

Sometimes I just LOVE my job!!


Ok, I ALWAYS love my job!!

But the last couple of days I have been working with JavaScript! I have been using the pseudocode in the text book and writing it in JavaScript to make it run. It is so fun!!

They are simple little programs that provide examples for the students.

The hardest one, so far, was one that had to do with interest. You had to take the amount of money you would LIKE to have at the end of a time period (in years that you specify), with an interest rate you provide, and the program tells you how much your initial deposit needs to be. Pretty cool.

The first problem I had was that I got the wrong answer; the program ran, but the initial amount needed to deposit was incorrect. (If I wanted to end up with $10,000 after 10 years at a low rate of interest, I would need to start with more that $1001!!). Once I got that worked out (my math formula in JavaScript was incorrect), then I had to correct the decimal places - I only needed two places not 8 or 9...

It was quite a challenge for me as I rarely write in JavaScript, and I spent quite a bit of time researching online. Then, I asked for help from my wonderful son-in-law (Andrew), and finally, my instructor, Mr. Long.

Mr. Long and I sat in front of our computers and finally got it working - I have to say; it was a joint effort!! I could not have done it without his input!! (I'm not sure he would have done it without my effort!! LOL)

Here is the pseudocode:

     1 Display "Enter the desired future value."
2 Input futureValue
3 Display "Enter the annual interest rate."
4 Input rate
5 Display "How many years will you let the money grow?"
6 Input years
7 Set presentValue = futureValue / (1 + rate)^years
8 Display "You will need to deposit $", presentValue

Here is the desired output:

Enter the desired future value.
10000 [Enter]
Enter the annual interest rate.
0.05 [Enter]
How many years will you let the money grow?
10 [Enter]
You need to deposit $6139

Sorry, not including the code!! LOL

It was a fun assignment!! I love doing stuff like that!