aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab4/CST116F2021-Lab4.cpp
diff options
context:
space:
mode:
authorLTB-Pravda <[email protected]>2021-11-02 15:04:12 -0700
committerLTB-Pravda <[email protected]>2021-11-02 15:04:12 -0700
commit082b47a6b127249ea86310965090204b25f27944 (patch)
treeeab4b8d4c68800ef0fdabda74f872074978fcd8f /CST116F2021-Lab4/CST116F2021-Lab4.cpp
parentUpdating GitHub with current work (diff)
downloadcst116-lab4-ltb-pravda-Education.tar.xz
cst116-lab4-ltb-pravda-Education.zip
Additions (9.3 and 9.3) are at the bottom of the programHEADEducationmaster
Diffstat (limited to 'CST116F2021-Lab4/CST116F2021-Lab4.cpp')
-rw-r--r--CST116F2021-Lab4/CST116F2021-Lab4.cpp71
1 files changed, 70 insertions, 1 deletions
diff --git a/CST116F2021-Lab4/CST116F2021-Lab4.cpp b/CST116F2021-Lab4/CST116F2021-Lab4.cpp
index 50c8e11..0720328 100644
--- a/CST116F2021-Lab4/CST116F2021-Lab4.cpp
+++ b/CST116F2021-Lab4/CST116F2021-Lab4.cpp
@@ -404,4 +404,73 @@ int main()
cout << endl;
}
return 0;
-}*/ \ No newline at end of file
+}*/
+/*
+#include <iostream>
+using namespace std;
+int main()
+{
+ int var_a = 1,
+ var_b = 2,
+ var_c = 3;
+ //return (void); - no error
+ //int return; - syntacial error as it's tryingto make return a variable, but it cannot.
+ //return var_a; - no error
+ //return (var_a, var_b, var_c); - runtime error. Only returns var_c
+ //return (var_a + var_b); - no error
+ //return; - no error
+ //return (true); - no error
+ //return('A', 'B'); - runtime error. Only shows ascii value of 'B'
+}*/
+#include <iostream>
+#include <iomanip>
+using namespace std;
+void GetInputs(float&, int&);
+void CalcRaise(float&, int&);
+int CalcBonus(int);
+void PrintCalculations(int, float, int);
+int main()
+{
+ float salary;
+ int years;
+ int bonus;
+
+ GetInputs(salary, years);
+ CalcRaise(salary, years);
+ bonus = CalcBonus(years);
+ PrintCalculations(years, salary, bonus);
+
+ return 0;
+}
+void GetInputs(float& salary, int& years)
+{
+ cout << "What is the employee's Salary? ";
+ cin >> salary;
+ cout << endl;
+ cout << "How many years has the employee worked? ";
+ cin >> years;
+ cout << endl;
+ return;
+}
+void CalcRaise(float& salary, int& years)
+{
+ if (years > 10)
+ salary += salary * .1;
+ else if (years >= 5)
+ salary += salary * .05;
+ else
+ salary += salary * .02;
+ return;
+}
+int CalcBonus(int years)
+{
+ int bonus;
+ bonus = (years / 2) * 500;
+ return bonus;
+}
+void PrintCalculations(int years, float salary, int bonus)
+{
+ cout << "Becuase the employee has worked " << years << " years:\n"
+ << "Their new salary is $" << salary << endl
+ << "They recieve a bonus of $" << bonus << endl;
+} \ No newline at end of file