-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJobs.cpp
More file actions
82 lines (70 loc) · 1.63 KB
/
Jobs.cpp
File metadata and controls
82 lines (70 loc) · 1.63 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "Jobs.h"
//Currency exchanger between money types
float Jobs::ExchangeCurrencyRates(float amount, std::string currencyFrom, std::string currencyTo)
{
float f;
float t;
//Currency to convert from
if (currencyFrom == "DOLLAR")
{
f = 1;
}
else if (currencyFrom == "GOLD")
{
f = 0.85;
}
else
{
f = 0.9;
}
//Currency to convert to
if (currencyTo == "DOLLAR")
{
t = 1;
}
else if (currencyTo == "GOLD")
{
t = 1.175;
}
else
{
t = 1.11;
}
return f * t * amount;
}
//Creates job and outputs job attributes
Jobs::Jobs(std::string jobName, float salary, std::string position):jobName(jobName), salary(salary), position(position)
{
std::cout << "New " << jobName << ", position: " << position << " urgently needed!" << std::endl;
std::cout << "Salary: " << salary << " DOLLARS, " << std::endl;
std::cout << " : " << ExchangeCurrencyRates(salary, "DOLLAR", "GOLD") << " GOLD COINS, " << std::endl;
std::cout << " : " << ExchangeCurrencyRates(salary, "DOLLAR", "GEM") << " GEMS, " << std::endl;
}
Jobs::~Jobs()
{
//dtor
}
//Gets salary
float Jobs::GetSalary()
{
return salary;
}
//Gets job position
std::string Jobs::GetPosition()
{
return position;
}
std::string Jobs::GetName()
{
return jobName;
}
//Make new salary
void Jobs::SetSalary(float newSalary)
{
salary = newSalary;
}
//Make new job position
void Jobs::SetPosition(std::string newPosition)
{
position = newPosition;
}