Beginner C/C++

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

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
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.
Specifically, your program will:
1. Output descriptive header
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;




cout<<"Please enter your First Name: ";
cin>>firstName;

cout<<"Please enter your Middle Initial: ";
cin>>middleInitial;

cout<<"Please enter your Last Name: ";
cin>>lastName;

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

cout<<"Please enter Loan Amount: ";
cin>>p;
cout<<"You entered "<<p<<endl;


cout<<"Please enter Loan Duration: ";
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
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.