Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. //Compound Interest based on Principle, Rate and Years
  2. //Libraries and Headers
  3. #include <iostream>
  4. #include <cmath>
  5. using namespace std;
  6. //Create class
  7. class calcCompInterest
  8. {
  9. public: double principle, radius, time;
  10.         double compoundInterest(){
  11.                 return principle * pow(1.0 + radius, time) - principle;
  12.         }
  13. //create array and give pointers
  14. calcCompInterest accountInfo[3];
  15.  
  16. //input data into array and process via calcCompInterest class
  17. int main() {        
  18.     double accountInfo, interest;    
  19.     cout <<"Enter the principal: ";    
  20.     cin >> accountInfo[0].principle;    
  21.     cout << "\n Enter rate: ";    
  22.     cin >> accountInfo[1].rate;    
  23.     cout << "\n Enter years: ";    
  24.     cin >> accountInfo[2].time;
  25.     cout << "\n The Compound Interest is: " << accountInfo[interest].compoundInterest << endl;        
  26.     system ("pause");    
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement