All except loaning.

Signed-off-by: Abdulkadir Furkan Şanlı <me@abdulocra.cy>
This commit is contained in:
Abdulkadir Furkan Şanlı
2022-01-04 23:34:35 +01:00
parent 87ca15456e
commit 26c5521eaa
2 changed files with 163 additions and 66 deletions
+18 -14
View File
@@ -22,7 +22,7 @@ public:
private:
time_t lastBailout = 0; // Time since last bailout.
double reserve = 0; // Total in bank reserves.
double reserve = 0; // Total in bank reserves.
std::vector<Bank *> banks;
};
@@ -42,13 +42,17 @@ public:
bool fire (Employee &x);
bool openAccount (Client &x);
bool closeAccount (Client &x);
bool newCredit (const std::string id, const double amount,
const int installments, const int days,
const float interest); // interest is additional interest on
// top of Gov rate.
double payInstallment (const int index);
void countEmployees ();
void listClients ();
// TODO: implement loans, for now there is placeholder loan() and unloan(),
// in order to simulate loaning and test bailout mechanism.
// bool newCredit (const std::string id, const double amount,
// const int installments, const int days,
// const float interest);
// double payInstallment (const int index);
auto countEmployees ();
auto countClients ();
bool loan (const double amount);
bool unloan (const double amount);
private:
Gov *centralBank;
@@ -56,13 +60,13 @@ private:
double current = 0; // Total current accts. of clients.
double creditable = 0; // Amount able to be loaned to clients.
double credited = 0; // Amount loaned.
struct creditRecord
struct creditRecord // TODO: implement loans, currently this struct is a dud.
{
time_t start;
long interval; // Interval of payments in number of seconds.
double amount;
int installments;
float interest;
// time_t start;
// long interval; // Interval of payments in number of seconds.
// double amount;
// int installments;
// float interest;
};
struct clientRecord
{