Advertisement
Guest User

Untitled

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