## Beginner C/C++

Moderators: None (Apply to moderate this forum)
Number of posts: 16943

This Forum Only

Need help writing program to calculate simple interest Posted by lucas99 on 25 Jan 2013 at 12:11 PM
Your objective is to write a program that calculates the simple interest for a given loan amount and
duration (in years).
Formula:
Simple interest = loan amount X interest rate X number of years
Assume interest rate is a constant 6% per year.
2. Prompt and read any customerâ€™s first name, middle initial, and last name individually
3. Prompt and read the principal/loan amount
4. Prompt and read the duration of the loan in years
5. Calculate the interest
6. Output:
a. Customer full name
b. Principal/loan amount
c. Duration of loan
d. Interest rate
e. Interest on loan
f. Principal and interest due at end of term

Ok i am stuck on how to use the simple interest formula how to declare it? its very confusing, i dont know where to begin with here is my program so far.

int main(){
system("color f0");

string firstName;
string middleInitial;
string lastName;
float p;
float r;
float t;
float si;

cin>>firstName;

cin>>middleInitial;

cin>>lastName;

cout<<"You entered "<<firstName<<" "<<middleInitial<<" "<<lastName<<endl;

cin>>p;
cout<<"You entered "<<p<<endl;

cin>>t;
cout<<"You entered "<<t<<endl;

si=(p*r*t)/100;

system("Pause");
return 0;
}// end of main

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic