-
Notifications
You must be signed in to change notification settings - Fork 0
/
clsUpdateCurrencyRate.h
60 lines (48 loc) · 1.41 KB
/
clsUpdateCurrencyRate.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
#pragma once
class clsUpdateCurrencyRate : protected clsScreen
{
private:
static void _PrintCurrencyCard(clsCurrency Currency)
{
cout << "\nCurrency Card :\n";
cout << "_______________________________\n";
cout << "Country : " << Currency.Country() << endl;
cout << "Code : " << Currency.CurrencyCode() << endl;
cout << "Name : " << Currency.CurrencyName() << endl;
cout << "Rate(1$) : " << Currency.Rate() << endl;
cout << "_______________________________\n";
}
static void _UpdateRate(clsCurrency Currency)
{
cout << "\nUpdate Currency Rate\n";
cout << "________________________\n";
cout << "\nEnter New Rate : ";
float NewRate = clsInputValidate::ReadFloatNumber("Error, enter the number again");
Currency.UpdateRate(NewRate);
_PrintCurrencyCard(Currency);
}
public:
static void ShowUpdateCurrencyRateScreen()
{
_DrawScreenHeader("\tUpdate Currency Screen");
string Code = "";
cout << "\nPlease enter Currency Code : ";
cin >> Code;
clsCurrency Currency = clsCurrency::FindByCode(Code);
if (!Currency.IsEmpty())
{
_PrintCurrencyCard(Currency);
char Update = 'y';
cout << "\nAre you sure to update the rate of this currency Y/N ? ";
cin >> Update;
if (toupper(Update) == 'Y')
{
_UpdateRate(Currency);
}
else
cout << "\nOperation Cancelled\n";
}
else
cout << "Currency code is not found \n";
}
};