From 6f6337d2a8520da25bff3a817f4732370f55d336 Mon Sep 17 00:00:00 2001 From: JacobAKnox <91796123+JacobAKnox@users.noreply.github.com> Date: Wed, 20 Oct 2021 19:53:42 -0700 Subject: 7b complete --- 7b/9.4Exercise/9.4Exercise.cpp | 60 ++++++++++++ 7b/9.4Exercise/9.4Exercise.sln | 31 ++++++ 7b/9.4Exercise/9.4Exercise.vcxproj | 147 +++++++++++++++++++++++++++++ 7b/9.4Exercise/9.4Exercise.vcxproj.filters | 22 +++++ 7b/Output.txt | 32 +++++++ 5 files changed, 292 insertions(+) create mode 100644 7b/9.4Exercise/9.4Exercise.cpp create mode 100644 7b/9.4Exercise/9.4Exercise.sln create mode 100644 7b/9.4Exercise/9.4Exercise.vcxproj create mode 100644 7b/9.4Exercise/9.4Exercise.vcxproj.filters create mode 100644 7b/Output.txt diff --git a/7b/9.4Exercise/9.4Exercise.cpp b/7b/9.4Exercise/9.4Exercise.cpp new file mode 100644 index 0000000..3e76174 --- /dev/null +++ b/7b/9.4Exercise/9.4Exercise.cpp @@ -0,0 +1,60 @@ +// 9.4Exercise.cpp : This file contains the 'main' function. Program execution begins and ends there. +// + +#include +using namespace std; + +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); + +int main() +{ + float salary; + int bonus, years_service; + + GetInput(salary, years_service); + CalcRaise(salary, years_service); + bonus = CalcBonus(years_service); + PrintCalculations(years_service, salary, bonus); +} + + +void GetInput(float& salary, int& years_service) +{ + cout << "Input the employee salary: "; + cin >> salary; + + cout << "\nInput the years the employee has worked: "; + cin >> years_service; + cout << "\n\n"; +} + +void CalcRaise(float& salary, int years_service) +{ + if (years_service >= 10) + { + salary *= 1.1; + } + else if (years_service >= 5) + { + salary *= 1.05; + } + else + { + salary *= 1.02; + } +} + +int CalcBonus(int years_service) +{ + int bonus; + bonus = (years_service / 2) * 500; + return bonus; +} + +void PrintCalculations(int years_service, float salary, int bonus) +{ + cout << "The employee has worked for " << years_service << " and as a result their new salary will be: $" << salary << ", and they will recive a bonus of: $" << bonus << "."; +} \ No newline at end of file diff --git a/7b/9.4Exercise/9.4Exercise.sln b/7b/9.4Exercise/9.4Exercise.sln new file mode 100644 index 0000000..b4f9353 --- /dev/null +++ b/7b/9.4Exercise/9.4Exercise.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31729.503 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "9.4Exercise", "9.4Exercise.vcxproj", "{1D797490-424E-4062-A43D-F8A1361D5694}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1D797490-424E-4062-A43D-F8A1361D5694}.Debug|x64.ActiveCfg = Debug|x64 + {1D797490-424E-4062-A43D-F8A1361D5694}.Debug|x64.Build.0 = Debug|x64 + {1D797490-424E-4062-A43D-F8A1361D5694}.Debug|x86.ActiveCfg = Debug|Win32 + {1D797490-424E-4062-A43D-F8A1361D5694}.Debug|x86.Build.0 = Debug|Win32 + {1D797490-424E-4062-A43D-F8A1361D5694}.Release|x64.ActiveCfg = Release|x64 + {1D797490-424E-4062-A43D-F8A1361D5694}.Release|x64.Build.0 = Release|x64 + {1D797490-424E-4062-A43D-F8A1361D5694}.Release|x86.ActiveCfg = Release|Win32 + {1D797490-424E-4062-A43D-F8A1361D5694}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FB2ADF7B-9BE1-42C7-8B49-16CB433643A8} + EndGlobalSection +EndGlobal diff --git a/7b/9.4Exercise/9.4Exercise.vcxproj b/7b/9.4Exercise/9.4Exercise.vcxproj new file mode 100644 index 0000000..03a47d4 --- /dev/null +++ b/7b/9.4Exercise/9.4Exercise.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {1d797490-424e-4062-a43d-f8a1361d5694} + My94Exercise + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/7b/9.4Exercise/9.4Exercise.vcxproj.filters b/7b/9.4Exercise/9.4Exercise.vcxproj.filters new file mode 100644 index 0000000..7902dfa --- /dev/null +++ b/7b/9.4Exercise/9.4Exercise.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/7b/Output.txt b/7b/Output.txt new file mode 100644 index 0000000..01fc8c5 --- /dev/null +++ b/7b/Output.txt @@ -0,0 +1,32 @@ +Input the employee salary: 500.50 + +Input the years the employee has worked: 10 + + +The employee has worked for 10 and as a result their new salary will be: $550.55, and they will recive a bonus of: $2500. +C:\Users\jakno\source\repos\CST116\cst116-lab4-JacobAKnox\7b\9.4Exercise\Debug\9.4Exercise.exe (process 7616) exited with code 0. +Press any key to close this window . . . + + + + +Input the employee salary: 100 + +Input the years the employee has worked: 7 + + +The employee has worked for 7 and as a result their new salary will be: $105, and they will recive a bonus of: $1500. +C:\Users\jakno\source\repos\CST116\cst116-lab4-JacobAKnox\7b\9.4Exercise\Debug\9.4Exercise.exe (process 4072) exited with code 0. +Press any key to close this window . . . + + + + +Input the employee salary: 100 + +Input the years the employee has worked: 3 + + +The employee has worked for 3 and as a result their new salary will be: $102, and they will recive a bonus of: $500. +C:\Users\jakno\source\repos\CST116\cst116-lab4-JacobAKnox\7b\9.4Exercise\Debug\9.4Exercise.exe (process 18760) exited with code 0. +Press any key to close this window . . . \ No newline at end of file -- cgit v1.2.3