-
Notifications
You must be signed in to change notification settings - Fork 0
/
clsWithDrawScreen.h
93 lines (72 loc) · 2.55 KB
/
clsWithDrawScreen.h
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
#pragma once
#include <iostream>
#include <iomanip>
#include <string>
#include "clsScreen.h"
#include "clsBankClient.h"
#include "clsInputValidate.h"
#include "clsMainScreen.h"
using namespace std;
class clsWithDrawScreen : protected clsScreen
{
private :
static void _PrintClient(clsBankClient Client)
{
cout << "\n\t~~~ Client Card ~~~ ";
cout << "\n======================================\n";
cout << "\nFirst Name : " << Client.FirstName;
cout << "\nLast Name : " << Client.LastName;
cout << "\nFull Name : " << Client.FullName();
cout << "\nEmail : " << Client.Email;
cout << "\nPhone : " << Client.Phone;
cout << "\nAccount Number : " << Client.GetAccountNumber();
cout << "\nPinCode : " << Client.PinCode;
cout << "\nAccount Balance: " << Client.AccountBalance;
cout << "\n\n======================================\n";
}
static string _ReadAccountNumber()
{
string AccountNumber = "";
cout << "\nPlease Enter Account Number : ";
AccountNumber = clsInputValidate::ReadString();
return AccountNumber;
}
public :
static void ShowWithDrawScreen()
{
_DrawScreenHeader("\t WithDraw Screen");
string AccountNumber = "";
AccountNumber = _ReadAccountNumber();
while (!clsBankClient::IsClientExist(AccountNumber))
{
cout << "\nClient with [" << AccountNumber << "] does not exist.\n";
AccountNumber = _ReadAccountNumber();
}
clsBankClient Client = clsBankClient::Find(AccountNumber);
_PrintClient(Client);
double Amount = 0;
cout << "\nPlease enter withdraw amount ? ";
Amount = clsInputValidate::ReadDblNumber();
char Answer = 'N';
cout << "\nAre you sure you want to perform this operation ? Y/N ? ";
cin >> Answer;
if(toupper(Answer)== 'Y')
{
if (Client.WithDraw(Amount))
{
cout << "\nAmount Withdrawd Successfully.\n";
cout << "\nNew Balance Is : " << Client.AccountBalance;
}
else
{
cout << "\nCannot Withdeaw , Insufficient Balance !\n";
cout << "\nAmount To Withdraw is " << Amount;
cout << "\nYour Balance is " << Client.AccountBalance;
}
}
else
{
cout << "\nOperation was cancelled.\n";
}
}
};