You are using a version without Ads of this website. Please, consider donating:

### Need help with program its annoying

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 SO THIS IS MY PROGRAM SO FAR. As you can see i got it all but i am so confused with as to for loan amount and duration of year, if i should use float or double to declare it??
Also for the interest rate how do i plug in the information and how or what do i declare for it, only part that i am confused on. ? if anyone can help me out. i looked it up on my book and just wont tell me!!
Pretty much i need to finish this assignment by calculating the simple interest and i dont know how or where to begin.
int main(){
system("color f0");

string firstName;
string middleInitial;
string lastName;

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;

system("Pause");
return 0;
}// end of main
Last edited on
since this looks like a school assignment I would suggest using double for the loan amount and the interest rate and the duration since the teacher might try to enter a value like 12.3 years to be tricky. As for how you plug in the info once they are declared you should be fine using cin to get the info just like you are for the rest.

also float and double are very similar so either can be used. The difference is just the decimal precision and the max size of the number but i doubt you need to be concerned with either in this assignment.
Last edited on
Topic archived. No new replies allowed.