This commit is contained in:
End Nightshade 2026-02-12 09:41:56 -07:00
parent a196ab1410
commit af5aaf330c
No known key found for this signature in database
3 changed files with 59 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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());
}
}

View file

@ -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);
}
}