diff --git a/src/InvalidTestScore.java b/src/InvalidTestScore.java index fdc275b..381edeb 100644 --- a/src/InvalidTestScore.java +++ b/src/InvalidTestScore.java @@ -1,3 +1,7 @@ +/** + * InvalidTestScore is a custom exception for the TestScores class. It is thrown when a score does not fall in valid + * range + */ public class InvalidTestScore extends IllegalArgumentException { public InvalidTestScore(String message) { super(message); diff --git a/src/Main.java b/src/Main.java index ca6fe08..c549672 100644 --- a/src/Main.java +++ b/src/Main.java @@ -32,6 +32,26 @@ public class Main { } public static void main(String[] args) { + // Main for q1 + // Test are 2 test score arrays that will throw the exception when we try to get the averages + int[] arr1 = {90, 91, -2, 21, 99}; + int[] arr2 = {90, 91, 101, 21, 99}; + try{ + TestScores t1 = new TestScores(arr1); + System.out.println(t1.getAverage()); + } + catch (Exception e) { + System.out.println(e.getMessage()); + } + //// + try{ + TestScores t2 = new TestScores(arr2); + System.out.println(t2.getAverage()); + } + catch (Exception e) { + System.out.println(e.getMessage()); + } + // Main for Q2