-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclsUpdateCurrencyRateScreen.h
More file actions
65 lines (47 loc) · 1.6 KB
/
Copy pathclsUpdateCurrencyRateScreen.h
File metadata and controls
65 lines (47 loc) · 1.6 KB
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
#include "clsScreen.h"
#include "clsCurrency.h"
#include "clsInputValidate.h"
class clsUpdateCurrencyRateScreen : protected clsScreen
{
private:
static void _PrindCardCurreny(clsCurrency Currency)
{
cout << "\nCurrency Card:\n";
cout << "_____________________________\n\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 _UpdateNewRate(clsCurrency& Currency)
{
cout << "\n\nUpdate Currency Rate:\n";
cout << "___________________________\n";
cout << "\nEnter New Rate: ";
Currency.UpdateRate(clsInputValidate::ReadFloatNumber());
cout << "\nCurrency Rate Updated Successfolly :-)";
}
public:
static void ShowUpdateCurrencyRateScreen()
{
_DrawScreenHeader("\tUpdate Currency Screen");
cout << "Please Enter Currency Code: ";
string Code = clsInputValidate::ReadString();
clsCurrency Currency = clsCurrency::FindByCode(Code);
while (!clsCurrency::IsCurrencyExist(Code))
{
cout << "\nCurrency is not found, choose another code.";
Code = clsInputValidate::ReadString();
}
Currency = clsCurrency::FindByCode(Code);
_PrindCardCurreny(Currency);
cout << "\nAre you sure you want to update the rate of this Currency y/n? ";
if (clsInputValidate::ReadYesOrNo())
{
_UpdateNewRate(Currency);
_PrindCardCurreny(Currency);
}
}
};