diff --git a/U2/L7/U2_L7_Activitiy_One.java b/U2/L7/U2_L7_Activitiy_One.java new file mode 100644 index 0000000..34511a2 --- /dev/null +++ b/U2/L7/U2_L7_Activitiy_One.java @@ -0,0 +1,15 @@ +/* Lesson 7 Coding Activity Question 1 */ + +import java.lang.Integer; + +public class U2_L7_Activity_One { + + public static void main(String[] args) { + Integer a = Integer.MAX_VALUE; + a++; + System.out.println(a); + Integer b = Integer.MIN_VALUE; + b--; + System.out.println(b); + } +} diff --git a/U2/L7/U2_L7_Activity_Three.java b/U2/L7/U2_L7_Activity_Three.java new file mode 100644 index 0000000..c662dcf --- /dev/null +++ b/U2/L7/U2_L7_Activity_Three.java @@ -0,0 +1,25 @@ +/* Lesson 7 Coding Activity Question 3 */ + +import java.lang.Integer; +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/U2/L7/U2_L7_Activity_Two.java b/U2/L7/U2_L7_Activity_Two.java new file mode 100644 index 0000000..fe46836 --- /dev/null +++ b/U2/L7/U2_L7_Activity_Two.java @@ -0,0 +1,19 @@ +import java.lang.Integer; +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(x + " " + y); + System.out.println("Enter values:"); + x = scan.nextInt(); + y = scan.nextInt(); + + Double avg = (double) (x + y) / 2; + System.out.println("Average of " + x + " and " + y + " is " + avg); + } +}