mirror of
https://github.com/System-End/APCSA.git
synced 2026-04-20 00:35:22 +00:00
25 lines
757 B
Java
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());
|
|
}
|
|
}
|