diff --git a/1ano/2semestre/poo/src/utils/MathTools.java b/1ano/2semestre/poo/src/utils/MathTools.java index 8744e9b..eeb34e9 100644 --- a/1ano/2semestre/poo/src/utils/MathTools.java +++ b/1ano/2semestre/poo/src/utils/MathTools.java @@ -1,5 +1,6 @@ package utils; +import java.util.List; import java.util.Random; public class MathTools { @@ -20,4 +21,15 @@ public class MathTools { return false; return true; } + + public static double sum(List list) { + double sum = 0; + for (double n : list) + sum += n; + return sum; + } + + public static double media(List list) { + return sum(list) / list.size(); + } }