mirror of
https://github.com/System-End/APCSA.git
synced 2026-04-19 21:05:16 +00:00
U2 lesson 5
This commit is contained in:
parent
5420c97f30
commit
f76c3022bb
3 changed files with 54 additions and 0 deletions
16
U2/L5/U2_L5_Activity_One.java
Normal file
16
U2/L5/U2_L5_Activity_One.java
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
/* Lesson 5 Coding Activity Question 1 */
|
||||||
|
|
||||||
|
import shapes.*;
|
||||||
|
|
||||||
|
public class U2_L5_Activity_One {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Circle c1 = new Circle(10.1);
|
||||||
|
Circle c2 = new Circle(14);
|
||||||
|
Circle c3 = new Circle(20.5);
|
||||||
|
|
||||||
|
System.out.println(c1);
|
||||||
|
System.out.println(c2);
|
||||||
|
System.out.println(c3);
|
||||||
|
}
|
||||||
|
}
|
||||||
16
U2/L5/U2_L5_Activity_Three.java
Normal file
16
U2/L5/U2_L5_Activity_Three.java
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
/* Lesson 5 Coding Activity Question 3 */
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
import shapes.*;
|
||||||
|
|
||||||
|
public class U2_L5_Activity_Three {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner scan = new Scanner(System.in);
|
||||||
|
System.out.println("Type a side length:");
|
||||||
|
double length = scan.nextDouble();
|
||||||
|
RegularPolygon eq = new RegularPolygon(length);
|
||||||
|
RegularPolygon sq = new RegularPolygon(4, length);
|
||||||
|
System.out.println(eq + "\n" + sq);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
U2/L5/U2_L5_Activity_Two.java
Normal file
22
U2/L5/U2_L5_Activity_Two.java
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
/* Lesson 5 Coding Activity Question 2 */
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
import shapes.*;
|
||||||
|
|
||||||
|
public class U2_L5_Activity_Two {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner input = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("Type a number for length and width:");
|
||||||
|
double firstInput = input.nextDouble();
|
||||||
|
System.out.println("Type a length:");
|
||||||
|
double secondInput = input.nextDouble();
|
||||||
|
System.out.println("Type a width:");
|
||||||
|
double thirdInput = input.nextDouble();
|
||||||
|
Rectangle rect1 = new Rectangle(firstInput, firstInput);
|
||||||
|
Rectangle rect2 = new Rectangle(secondInput, thirdInput);
|
||||||
|
System.out.println(rect1);
|
||||||
|
System.out.println(rect2);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue