diff --git a/.vscode/launch.json b/.vscode/launch.json index f88ce9f..799cdc9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,5 +1,12 @@ { "configurations": [ + { + "type": "java", + "name": "U2_L7_Activity_Two", + "request": "launch", + "mainClass": "Unit2.U2_L7_Activity_Two", + "projectName": "my-app" + }, { "type": "java", "name": "Test", diff --git a/src/main/java/Unit2/U2_L7_Activity_One.java b/src/main/java/Unit2/U2_L7_Activity_One.java new file mode 100644 index 0000000..e64f359 --- /dev/null +++ b/src/main/java/Unit2/U2_L7_Activity_One.java @@ -0,0 +1,15 @@ +/* Lesson 7 Coding Activity Question 1 */ +package Unit2; + +public class U2_L7_Activity_One +{ + public static void main(String[] args) + { + Integer a = Integer.MAX_VALUE; + a += 1; + System.out.println(a); + Integer b = Integer.MIN_VALUE; + b -= 1; + System.out.println(b); + } +} diff --git a/src/main/java/Unit2/U2_L7_Activity_Three.java b/src/main/java/Unit2/U2_L7_Activity_Three.java new file mode 100644 index 0000000..573cbc0 --- /dev/null +++ b/src/main/java/Unit2/U2_L7_Activity_Three.java @@ -0,0 +1,26 @@ +// /* Lesson 7 Coding Activity Question 3 */ + +// import java.util.Scanner; +// import shapes.*; + +// public class U2_L7_Activity_Three +// { +// public static void main(String[] args) +// { + +// Scanner scan = new Scanner(System.in); +// Integer sides; +// Double length; + +// System.out.println("Enter number of sides:"); +// sides = scan.nextInt(); +// System.out.println("Enter side length:"); +// length = scan.nextDouble(); + +// RegularPolygon p1 = new RegularPolygon(sides, length); +// RegularPolygon p2 = new RegularPolygon(sides+1, length*2); + +// System.out.println("The area of a " + p1 + " is: " + p1.getArea()); +// System.out.println("The area of a " + p2 + " is: " + p2.getArea()); +// } +// } diff --git a/src/main/java/Unit2/U2_L7_Activity_Two.java b/src/main/java/Unit2/U2_L7_Activity_Two.java new file mode 100644 index 0000000..6132f7c --- /dev/null +++ b/src/main/java/Unit2/U2_L7_Activity_Two.java @@ -0,0 +1,25 @@ +package Unit2; + +import java.util.Scanner; + +public class U2_L7_Activity_Two +{ + public static void main(String[] args) + { + + Scanner scan = new Scanner(System.in); + Integer x = null; + Integer y = null; + + System.out.println("null null"); + System.out.println("Enter values:"); + System.out.print(">"); + x = scan.nextInt(); + System.out.print("\n>"); + y = scan.nextInt(); + + Double avg = ((double) x + y) / 2; + System.out.println("Average of " + x + " and " + y + " is " + avg); + scan.close(); + } +}