can someone help me...
Author |
Message |
kid105
|
Posted: Wed Dec 09, 2009 10:03 pm Post subject: can someone help me... |
|
|
What is it you are trying to achieve?
write a program which will calculate and print a table showing how a cash investment on term deposit in a bank accumulates over a period of time given a certain compounding period.
the program will ask the user for:
A) cash investment
B) interest rate: entered by user either as a decimal or a percent. programs should convert to decimal if necessary.
C) compounding period: monthly, quarterly, semi-annually, or annually.
D) term of investment: in months
What is the problem you are having?
just guide me through it
Describe what you have tried to solve this problem
its written below
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
var initial_amount, interest_rate, term, interest : int
var compounding_period, M, Q, S, A : string
put "initial amount: $ " ..
get initial_amount
put "interest rate: % " ..
get interest_rate
put "compounded: M,Q,S,A " ..
get compounding_period
put "Term: Months " ..
get term
interest := initial_amount * interest_rate * term
Turing: |
var initial_amount, interest_rate, term, interest : int
var compounding_period, M, Q, S, A : string
put "initial amount: $ " ..
get initial_amount
put "interest rate: % " ..
get interest_rate
put "compounded: M,Q,S,A " ..
get compounding_period
put "Term: Months " ..
get term
interest := initial_amount * interest_rate * term
|
Please specify what version of Turing you are using
any turing |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
ecookman
![](http://compsci.ca/v3/uploads/user_avatars/5690458955648ca661c338.gif)
|
Posted: Thu Dec 10, 2009 4:07 pm Post subject: RE:can someone help me... |
|
|
aah, if i understand properly,
you can't tell the computer to do the math quite the way you have you can not say, intrest= ....
you have to have the computer do the math before, or as you have done it but by removing the intrest variable and
code: |
put "your interest is", initial_amount * interest_rate * term
|
*NOTE*
I am rusty at truing the syntax might be wrong but I am sure the logic is right. |
|
|
|
|
![](images/spacer.gif) |
BigBear
|
Posted: Thu Dec 10, 2009 4:16 pm Post subject: RE:can someone help me... |
|
|
A = P (1+i)^n
A = Final Amount
P = Initial amount
i = interest rate per compound period
n = number of compound periods
So you need to take the interest rate and divide it by the number of compound periods |
|
|
|
|
![](images/spacer.gif) |
|
|