aboutsummaryrefslogtreecommitdiff
path: root/week12/Exercise4/Company.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'week12/Exercise4/Company.cpp')
-rw-r--r--week12/Exercise4/Company.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/week12/Exercise4/Company.cpp b/week12/Exercise4/Company.cpp
new file mode 100644
index 0000000..9b172bd
--- /dev/null
+++ b/week12/Exercise4/Company.cpp
@@ -0,0 +1,19 @@
+#include "Company.h"
+#include <iostream>
+
+Company::~Company() {
+ for (int i = 0; i < 128; i++) {
+ delete employees[i];
+ }
+}
+
+float Company::PaymentDifference() {
+ float total = 0, performanced = 0;
+ for (int i = 0; i < 128; i++) {
+ if (employees[i] == nullptr) continue;
+
+ total += employees[i]->paycheck;
+ performanced += employees[i]->paycheck * employees[i]->efficiency;
+ }
+ return total - performanced;
+}