1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
#ifndef CUSTOMER_H
#define CUSTOMER_H
#include <iostream>
#include <fstream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <sstream>
using namespace std;
//Customer Class
class Customer {
private:
string name; //name of customer
string ssn; // social security number
string address; // address
string birthDate; //birth date
double savings; // savings account balance
double checking; // checking account balance
double balance; // Consoldated Balance
public:
Customer(); //constructor
Customer(string, string, string, string ,int, int);
void setName(string);
void setSSN(string);
void setAddress(string);
void setBirthDate(string);
void setSavings(double);
void setChecking(double);
void setBalance(double);
void operator +=( double );
void operator -=( double );
void operator ++ ();
string getName();
string getSSN();
string getAddress();
string getBirthDate();
double getSavings();
double getChecking();
double getBalance();
void displayCustomer();
string string_displayCustomer();
};
//-----------------------------------------------------------------------------
//class definition
Customer::Customer() {
name = " ";
ssn = " ";
address = " ";
birthDate = " ";
savings = 0;
checking = 0;
balance = 0;
}
Customer::Customer(string name, string ssn, string address, string birthDate, int savings, int checking) {
Customer::name = name;
Customer::ssn = ssn;
Customer::address = address;
Customer::birthDate = birthDate;
Customer::savings = savings;
Customer::checking = checking;
Customer::balance = balance;
}
void Customer::setName(string name) {
Customer::name = name;
}
void Customer::setSSN(string ssn) {
Customer::ssn = ssn;
}
void Customer::setAddress(string address) {
Customer::address = address;
}
void Customer::setBirthDate(string birthDate) {
Customer::birthDate = birthDate;
}
void Customer::setSavings(double savings) {
Customer::savings = savings;
}
void Customer::setChecking(double checking) {
Customer::checking = checking;
}
void Customer::setBalance(double balance) {
Customer::balance = balance;
}
string Customer::getName() {
return name;
}
string Customer::getSSN() {
return ssn;
}
string Customer::getAddress() {
return address;
}
string Customer::getBirthDate() {
return birthDate;
}
double Customer::getSavings() {
return savings;
}
double Customer::getChecking() {
return checking;
}
double Customer::getBalance() {
return balance;
}
void Customer::displayCustomer() {
cout << "The current customer is " << name << ", their address is " << address << ", and their Social Security Number is "
<< ssn << ". " << name << "'s Saving Account Ballance is:" << savings << ". The Checking Account Balance is:" << checking << ".\n";
cout << "The consolidated balance is: $" << balance << ".\n";
}
string Customer::string_displayCustomer() {
stringstream buf;
cout << "The current customer is " << name << ", their address is " << address << ", and their Social Security Number is "
<< ssn << ". " << name << "'s Saving Account Ballance is:" << savings << ". The Checking Account Balance is:" << checking << ".\n";
cout << "The consolidated balance is: $" << balance << ".\n";
return buf.str();
}
void Customer::operator += ( double dValue ) {
setBalance( getBalance()+ dValue );
//return this;
}
void Customer::operator -= ( double dValue ) {
setBalance( getBalance() - dValue );
//return this;
}
void Customer::operator ++ () {
setBalance(getSavings() + getChecking());
}
#endif
|