]> Git Server - tankstelle.git/commitdiff
Added method to calculate the total number of employees
authorRobin Cheney <cheneyr@eternal.ddnss.de>
Sun, 16 Nov 2025 09:22:10 +0000 (10:22 +0100)
committerRobin Cheney <cheneyr@eternal.ddnss.de>
Sun, 16 Nov 2025 09:22:10 +0000 (10:22 +0100)
src/main/java/de/diejungsvondertanke/tankstelle/Main.java

index c06085ea0a2f0e86385a1f9d69a7e6a3f52d246a..8b3ba1fb980d60c5cb28ac4b3eca7ecc063a86f8 100644 (file)
@@ -192,4 +192,18 @@ public class Main {
         }
         return result.toArray(new FuelStation[0]);
     }
+
+    /**
+     * Calculate and return the total number of employees across all
+     * {@link FuelStation fuel station}s
+     * 
+     * @return total staff count
+     */
+    public static int getTotalNumberOfEmployees() {
+        int sum = 0;
+        for (FuelStation station : fuelStations) {
+            sum += station.getNumber_of_employees();
+        }
+        return sum;
+    }
 }
\ No newline at end of file