-
Notifications
You must be signed in to change notification settings - Fork 0
/
clsTransferScreen.h
66 lines (57 loc) · 2.05 KB
/
clsTransferScreen.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
#pragma once
class clsTransferScreen : protected clsScreen
{
private:
static void _PrintClientCard(clsBankClient Client)
{
cout << "\nClient Card : \n";
cout << "_________________________________\n";
cout << "\nFull Name : " << Client.FullName() << endl;
cout << "Acc. Number : " << Client.GetAccountNumber() << endl;
cout << "Balance : " << Client.AccountBalance << endl;
cout << "_________________________________\n";
}
static string _ReadAccountNumber()
{
string AccountNumber = "";
AccountNumber = clsInputValidate::ReadString();
while (!clsBankClient::IsClientExist(AccountNumber))
{
cout << "\nAccount number is not found, choose another one: ";
AccountNumber = clsInputValidate::ReadString();
}
return AccountNumber;
}
public:
static void ShowTransferScreen()
{
_DrawScreenHeader("\tTransfer Screen");
cout << "\nPlease Enter client Account Number to Transfer From: ";
string AccountNumber = _ReadAccountNumber();
clsBankClient ClientToTransferFrom = clsBankClient::Find(AccountNumber);
_PrintClientCard(ClientToTransferFrom);
cout << "\nPlease Enter client Account Number to Transfer to: ";
AccountNumber = _ReadAccountNumber();
clsBankClient ClientToTransferTo = clsBankClient::Find(AccountNumber);
_PrintClientCard(ClientToTransferTo);
cout << "\nPlease enter Transfer amount ? ";
float TransferAmount = clsInputValidate::ReadFloatNumber("Error number, enter again ");
while (TransferAmount > ClientToTransferFrom.AccountBalance)
{
cout << "\nAmount Exceeds the available , please enter another Amount ? ";
TransferAmount = clsInputValidate::ReadFloatNumber("Error number, enter again ");
};
char Perform = 'y';
cout << "\nAre you sure you want to perform this transaction ?";
cin >> Perform;
if (toupper(Perform) == 'Y')
{
ClientToTransferFrom.Transfer(ClientToTransferTo, TransferAmount);
cout << "\nTransfer done successfully.\n";
_PrintClientCard(ClientToTransferFrom);
_PrintClientCard(ClientToTransferTo);
}
else
cout << "\nOperation was cancelled.";
}
};