APCSA/U2/L7/U2_L7_Activity_Three.java
End Nightshade af5aaf330c
L7
2026-02-12 09:41:56 -07:00

25 lines
757 B
Java

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