Advertisement
fifimn

SavingsAccountCpp

Sep 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. #include "SavingsAccount.h"
  2. #include<iostream>
  3. #include<string>
  4. #include "Customers.h"
  5.  
  6. using namespace std;
  7.  
  8.  
  9.  
  10. SavingsAccount::SavingsAccount()
  11. {
  12.     account_number = 0;
  13.     balance = 0.0;
  14.     interest = 0.0;
  15. }
  16. SavingsAccount::SavingsAccount(int accountNumber, double accountBalance, float interestRate)
  17. {
  18.     account_number = accountNumber;
  19.     accountBalance = 100;
  20.     balance = accountBalance;
  21.  
  22.     interestRate = 3;
  23.     interest = interestRate;
  24.  
  25. }
  26. void SavingsAccount::showAccount()
  27. {
  28.     Customers customer;;
  29.     customer.showCustomers;
  30.  
  31.     cout << " Account Number:" << account_number << endl;
  32.     cout << " Account Balance: " << balance << endl;
  33.     cout << " Interest Rate: " << interest << endl;
  34.  
  35.     cout << endl;
  36.  
  37. }
  38. Customers::Customers()
  39. {
  40.     string firstname;
  41.     string lastname;
  42.    
  43.  
  44.     cout << " Enter your First Name: ";
  45.     cin >>  firstname ;
  46.     cout << " Enter your Last Name: ";
  47.     cin >> lastname;
  48.    
  49.     cout << endl;
  50. }
  51. void Customers::showCustomers()
  52. {
  53.     cout << "First Name: " << first_name << endl;
  54.     cout << "Last Name:" << last_name << endl;
  55.  
  56. }
  57. int main()
  58. {
  59.     SavingsAccount sa1;
  60.     sa1.showAccount();
  61.  
  62.     int n;
  63.     cout << "Enter your account number: ";
  64.     cin >> n;
  65.  
  66.     SavingsAccount sa2(n, 100, 3);
  67.     sa2.showAccount();
  68. }
  69.  
  70. SavingsAccount::~SavingsAccount()
  71. {
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement