From 280cb2c794055ad8e4b4015e97055e959380d129 Mon Sep 17 00:00:00 2001 From: 101zh <67253838+101zh@users.noreply.github.com> Date: Mon, 9 Oct 2023 20:35:28 +0000 Subject: [PATCH] feat(3.2.1): Finished U3_L2_Activity_One --- .vscode/launch.json | 7 +++++ src/main/java/Unit3/U3_L2_Activity_One.java | 29 +++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/main/java/Unit3/U3_L2_Activity_One.java diff --git a/.vscode/launch.json b/.vscode/launch.json index 2d16747..ae6fb83 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,5 +1,12 @@ { "configurations": [ + { + "type": "java", + "name": "U3_L2_Activity_One", + "request": "launch", + "mainClass": "Unit3.U3_L2_Activity_One", + "projectName": "my-app" + }, { "type": "java", "name": "Testing", diff --git a/src/main/java/Unit3/U3_L2_Activity_One.java b/src/main/java/Unit3/U3_L2_Activity_One.java new file mode 100644 index 0000000..07b0228 --- /dev/null +++ b/src/main/java/Unit3/U3_L2_Activity_One.java @@ -0,0 +1,29 @@ +package Unit3; + +import java.util.Scanner; + +public class U3_L2_Activity_One { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + System.out.println("Please enter five numbers"); + double[] nums = new double[5]; + + for (int i = 0; i < 5; i++) { + nums[i] = scanner.nextDouble(); + } + + double average = 0.0; + + for (int i = 0; i < 5; i++) { + average += nums[i]; + } + + average /= 5; + + if (average>=89.95){ + System.out.println("ABOVE AVERAGE"); + } + + scanner.close(); + } +}