-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPerson.cpp
More file actions
66 lines (62 loc) · 1.63 KB
/
Person.cpp
File metadata and controls
66 lines (62 loc) · 1.63 KB
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
//Methods primarily for bank and person header files
#include <iostream>
#include<algorithm>
#include<fstream>
using namespace std;
//BANK METHODS
#include "bank.h"
#include "person.h"
#include "Account.h"
#include "Cd.h"
//PERSON METHODS
Person::Person(string name, int dob, int phone, string email, string pass) { //Consstructor for person with all the parameters
this->name = name;
dateOfBirth = dob;
phoneNo = phone;
this->email = email;
password = pass;
}
void Person::createAccount(long num, double balance, int type) {
//Call account constructor, based on the number given
if (type == 1) {//Calls CD constructor
int term;
cout << "How many months is the term?" << endl;
cin >> term;
CD myCd(num, balance, term);
accPtr[0] = &myCd;
}
else if (type == 2) {//Calls MM constructor
}
else if (type == 3) {//Calls Savings constructor
}
else if (type == 4) {//Calls Checking constructor
}
}
Account* Person::getAccount(int index) {
return *(accPtr + index); //Returns the account at the given index
}
void Person::removeAccount(int index) {
if (index == 1) {//Calls the default constructor for the account linked to that index
CD defCD();
accPtr[0] = &defCD;
}
else if (index == 2) {
MM defMM();
accPtr[1] = &defMM;
}
else if (index == 3) {
Savings defSav();
accPtr[2] = &defSav;
}
else if (index == 4) {
Checking defCheck();
accPtr[3] = &defCheck;
}
}
Person::Person() { //Default constructor that sets all customer identifiers to null, as a way to erase customers.
name = '\0';
dateOfBirth = NULL;
phoneNo = NULL;
email = '\0';
password = '\0';
}