aboutsummaryrefslogtreecommitdiff
path: root/week12/Exercise4/Company.cpp
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2024-05-10 12:27:14 +0300
committerSyndamia <kamen@syndamia.com>2024-05-10 12:27:14 +0300
commiteb6305c8b0a71a613a34edbcabdaf1fde259451d (patch)
tree2ba4402c82569810ab4287175670193597cc52d4 /week12/Exercise4/Company.cpp
parent8dd9b39fa54a91030cdd5fe71973f78f7e8089e0 (diff)
downloadoop-2023-solutions-eb6305c8b0a71a613a34edbcabdaf1fde259451d.tar
oop-2023-solutions-eb6305c8b0a71a613a34edbcabdaf1fde259451d.tar.gz
oop-2023-solutions-eb6305c8b0a71a613a34edbcabdaf1fde259451d.zip
[w12] Finished ex 4
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;
+}