55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
//person.h
|
|
|
|
#ifndef __PERSON_H__
|
|
|
|
#define __PERSON_H__
|
|
|
|
#include "police.h"
|
|
|
|
#include "atm.h"
|
|
|
|
|
|
|
|
#include "cashcard.h"
|
|
|
|
#include "bank.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
class Person {
|
|
|
|
private:
|
|
|
|
Name myName;
|
|
|
|
int myAge;
|
|
|
|
double cash;
|
|
|
|
Passport *myPass;
|
|
|
|
Cashcard *myCard;
|
|
|
|
public:
|
|
|
|
Person(Name &N, int &age):myName(N) { //Constructor
|
|
|
|
myPass=NULL;
|
|
|
|
myCard=NULL;
|
|
|
|
cash=0;
|
|
|
|
myAge=age;
|
|
|
|
}
|
|
|
|
~Person(){}
|
|
|
|
const Name &getName() { return myName; }
|
|
|
|
int getPassport(Police &myStation) {
|
|
|
|
if(myPass)
|
|
|
|
return NULL;
|
|
|
|
myPass = myStation.makePassport(*this);
|
|
|
|
};
|
|
|
|
int getCashcard(Bank &myBank) {
|
|
|
|
if(myCard)
|
|
|
|
return NULL;
|
|
|
|
myCard = myBank.makeCashcard(*myPass);
|
|
|
|
};
|
|
|
|
double getMoney(ATM &myATM, double &money) {
|
|
|
|
if(!myCard)
|
|
|
|
return NULL;
|
|
|
|
cash = myATM.withDraw(*myCard, money);
|
|
|
|
return cash;
|
|
|
|
};
|
|
|
|
int insertMoney(Bank &myBank, double &money) {
|
|
|
|
if(!myCard)
|
|
|
|
return NULL;
|
|
|
|
return(myBank.insertMoney(*myCard, money));
|
|
|
|
}
|
|
|
|
void print() {
|
|
|
|
myName.print();
|
|
|
|
if(myPass)
|
|
|
|
myPass->print();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
#endif
|
|
|