diff options
| author | austinsworld15 <[email protected]> | 2021-10-26 16:33:38 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-26 16:33:38 -0700 |
| commit | c60f4e297f23e95a04ed87656097116b6d1a6d30 (patch) | |
| tree | 16250755f0f69de181d8177329696f20560bb6e0 | |
| parent | Update CST116F2021-Lab4.cpp (diff) | |
| download | cst116-lab4-austinsworld15-c60f4e297f23e95a04ed87656097116b6d1a6d30.tar.xz cst116-lab4-austinsworld15-c60f4e297f23e95a04ed87656097116b6d1a6d30.zip | |
Update CST116F2021-Lab4.cpp
| -rw-r--r-- | CST116F2021-Lab4/CST116F2021-Lab4.cpp | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/CST116F2021-Lab4/CST116F2021-Lab4.cpp b/CST116F2021-Lab4/CST116F2021-Lab4.cpp index c9cfd09..312f3c3 100644 --- a/CST116F2021-Lab4/CST116F2021-Lab4.cpp +++ b/CST116F2021-Lab4/CST116F2021-Lab4.cpp @@ -32,11 +32,71 @@ h. This is fine. It will return with code 66 for some reason, but it works. note 1. +#include <iostream> +#include <iomanip> +using std::cout; +using std::string; +using namespace::std; - 7c 9.5 pg 216 #2 +void GetInput(float&salary, int&years_service); +void CalcRaise(float& salary, int& years_service); +int CalcBonus(int years_service); +void PrintCalculations(int years_service, float salary, int bonus); + +void GetInput(float& salary, int& years_service) + { + cout << "Enter employee's salary: "; + std::cin >> salary; + if (salary > 0) + { + cout << "enter the employee's years of service: "; + std::cin >> years_service; + } + } + void CalcRaise(float& salary, int& years_service) + { + + if (years_service > 10) + { + cout << "10% will raise\n"; + } + else if (years_service > 5) + { + cout << "5% will raise\n"; + } + else + { + cout << "2% will raise\n"; + } + } + int CalcBonus(int years_service) + { + int calculate_bonus = 500 * (int)(years_service / 2); + return calculate_bonus; + } + void PrintCalculations(int years_service, float salary, int bonus) + { + cout << "Your total years of service is " << years_service << endl; + cout << "Your salary is " << salary << endl; + cout << "Your total bonus is " << bonus << endl; + } +int main() +{ + float salary=0; + int years_service=0; + + GetInput(salary, years_service); + CalcRaise(salary, years_service); + PrintCalculations(years_service, salary, CalcBonus(years_service)); + return 0; +} + + + + 7c 9.5 pg 216 #1 -2. +1. |