Given principle, yearly interest rate and time in years, I need to calculate interest earned and the ending amount in the account at the end of time.
Formulas:
I=PRT
S=P+T
This is what I have which didn’t work:
<script type=“text/javascript”>
var P,R,T,I,S;
P=prompt("enter your Principle","");
R=prompt("enter your Rate","");
T=prompt("enter the time in years","");
I=P*R*T;
S=P+I;
document.write("Interest= "+P+"*"+R+"*"+T+"<br />");
document.write("S= "+P+"+"+I+"<br />");
I finally got the Interest to multiply, but I can’t get the Summary to add up. It’s adding the Principle and Interest as 100100 when it should be 200.
<script type=“text/javascript”>
var P,R,T,I,S;
P=prompt("enter your Principle","");
R=prompt("enter your Rate","");
T=prompt("enter the time in years","");
I=P*R*T;
S=P+I;
document.write("Interest= " +P*R*T+"<br />");
document.write("Sum of Account= " +(P+I)+"<br />");
Still confused…I’m not able to get the Sum of Account to add up. Sum= Principle + Interest.
The Principle+ Interest is not adding up, but it is joined together according to my document.write code. :headbang: