You take the formula for simple interest, and create a function based off of it.
The formula to generate simple interest is:
Interest = Principal * Rate * Time
In this case "time" refers to the number of periods for which interest will be applied.
In most cases you're going to want to solve this equation for interest. So, you write a JavaScript function that will do the math for you. The function should take Principal, Rate, and Time as parameters, and return Interest.
function calculateSI ( p, r, t ){
//You want to check that p, r, and t are appropriate values and//types. I'll skip that here for brevityreturn p*r*t;
}
That's all there is to it. To call the function, you'd pass in values in the proper order, of define them in the call. Then you capture the returned value with a variable like so:
var simpleInterest = calculateSI ( 5000, 0.12, 64 );
//simpleInterest would now hold the value of "38400."
I've gone ahead and create a JSFiddle example for you in which I set up a form to deal with acquiring and displaying the values. That version also shows how to write a single function to solve for any of the missing variables. (See related link.)
begin enter Principal amount(Input) enter interest rate(Input) calculate simple interest(Computation/Processing) Display/Show/Print Give sound Simple Interest(output) end By Tomas Naxweka(Namibia)
algorithms is language independent
Solve simple intress usin fortran
Onclick will be called when the object you're attaching the onclick function to is clicked (usually the object is an HTML element).
No, there is no need for JavaScript in normal circumstances. There is no need for any programming or scripting languages for web-based programming if you are good with html.But things are rarely that simple. Most websites make use of AJAX and Javascript is essential for it.
Draw a flow chart to calculate simple interest with 10% rate if time is greater than 2 yrs otherwise calculate simple interest with 5%.
simple interest = principle (money) times the rate times the time
The simple interest, on an amount Y, at rate r% per year, for t years is I = Y*(r/100)*t But bank interest is always compounded, never simple.
change % to decimal
To calculate an interest (as money), multiply the capital, times the interest rate (divided by 100, if it is expressed in percent), times the number of periods. The above assumes simple interest; compound interest is a bit more complicated.
18.90currency as an interest..
begin enter Principal amount(Input) enter interest rate(Input) calculate simple interest(Computation/Processing) Display/Show/Print Give sound Simple Interest(output) end By Tomas Naxweka(Namibia)
1,773.60
The simple interest over a period of five years is $463.70
Another answer from Apex is... compounding frequency
algorithms is language independent
56.72