From fe0e16568d0e2b200984057a0ae5a179071b0791 Mon Sep 17 00:00:00 2001 From: 101zh <67253838+101zh@users.noreply.github.com> Date: Wed, 25 Oct 2023 16:13:50 +0000 Subject: [PATCH 1/3] feat(4.1.1): Finish U4_L1_Activity_One --- .vscode/launch.json | 7 +++++++ src/main/java/Unit4/U4_L1_Activity_One.java | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/main/java/Unit4/U4_L1_Activity_One.java diff --git a/.vscode/launch.json b/.vscode/launch.json index 2d68418..b72fe2a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,5 +1,12 @@ { "configurations": [ + { + "type": "java", + "name": "U4_L1_Activity_One", + "request": "launch", + "mainClass": "Unit4.U4_L1_Activity_One", + "projectName": "my-app" + }, { "type": "java", "name": "Assignment3", diff --git a/src/main/java/Unit4/U4_L1_Activity_One.java b/src/main/java/Unit4/U4_L1_Activity_One.java new file mode 100644 index 0000000..607b503 --- /dev/null +++ b/src/main/java/Unit4/U4_L1_Activity_One.java @@ -0,0 +1,20 @@ +package Unit4; + +import java.util.Scanner; + +public class U4_L1_Activity_One { + public static void main(String[] args){ + Scanner scanner = new Scanner(System.in); + + int num=0; + System.out.println("Enter any numbers (Enter 5 to stop)"); + int sum=0; + while (num!=5){ + sum+=num; + num=scanner.nextInt(); + } + + System.out.println("Sum is "+sum); + scanner.close(); + } +} From d4064ef308c66ddb9b94d52d960bff7f4d1a4214 Mon Sep 17 00:00:00 2001 From: 101zh <67253838+101zh@users.noreply.github.com> Date: Wed, 25 Oct 2023 16:15:00 +0000 Subject: [PATCH 2/3] feat(4.1.2): Finish U4_L1_Activity_Two --- .vscode/launch.json | 7 +++++++ src/main/java/Unit4/U4_L1_Activity_Two.java | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/main/java/Unit4/U4_L1_Activity_Two.java diff --git a/.vscode/launch.json b/.vscode/launch.json index b72fe2a..0043355 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,5 +1,12 @@ { "configurations": [ + { + "type": "java", + "name": "U4_L1_Activity_Two", + "request": "launch", + "mainClass": "Unit4.U4_L1_Activity_Two", + "projectName": "my-app" + }, { "type": "java", "name": "U4_L1_Activity_One", diff --git a/src/main/java/Unit4/U4_L1_Activity_Two.java b/src/main/java/Unit4/U4_L1_Activity_Two.java new file mode 100644 index 0000000..d6282f8 --- /dev/null +++ b/src/main/java/Unit4/U4_L1_Activity_Two.java @@ -0,0 +1,21 @@ +package Unit4; + +import java.util.Scanner; + +public class U4_L1_Activity_Two { + public static void main(String[] args){ + Scanner scanner = new Scanner(System.in); + + int largest=0; + int num=0; + while (num!=-1){ + num = scanner.nextInt(); + if(largest Date: Wed, 25 Oct 2023 16:16:06 +0000 Subject: [PATCH 3/3] feat(4.1.3): Finish U4_L1_Activity_Three --- .vscode/launch.json | 7 ++++++ src/main/java/Unit4/U4_L1_Activity_Three.java | 24 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/main/java/Unit4/U4_L1_Activity_Three.java diff --git a/.vscode/launch.json b/.vscode/launch.json index 0043355..f260dec 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,5 +1,12 @@ { "configurations": [ + { + "type": "java", + "name": "U4_L1_Activity_Three", + "request": "launch", + "mainClass": "Unit4.U4_L1_Activity_Three", + "projectName": "my-app" + }, { "type": "java", "name": "U4_L1_Activity_Two", diff --git a/src/main/java/Unit4/U4_L1_Activity_Three.java b/src/main/java/Unit4/U4_L1_Activity_Three.java new file mode 100644 index 0000000..f9d457d --- /dev/null +++ b/src/main/java/Unit4/U4_L1_Activity_Three.java @@ -0,0 +1,24 @@ +package Unit4; + +import java.util.Scanner; + +public class U4_L1_Activity_Three { + public static void main(String[] args){ + Scanner scanner = new Scanner(System.in); + + System.out.println("Input a word:"); + String word =scanner.nextLine(); + + int index=0; + while (index