mirror of
https://github.com/System-End/APCSA.git
synced 2026-04-19 16:38:24 +00:00
L7
This commit is contained in:
parent
a196ab1410
commit
af5aaf330c
3 changed files with 59 additions and 0 deletions
15
U2/L7/U2_L7_Activitiy_One.java
Normal file
15
U2/L7/U2_L7_Activitiy_One.java
Normal 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);
|
||||
}
|
||||
}
|
||||
25
U2/L7/U2_L7_Activity_Three.java
Normal file
25
U2/L7/U2_L7_Activity_Three.java
Normal 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());
|
||||
}
|
||||
}
|
||||
19
U2/L7/U2_L7_Activity_Two.java
Normal file
19
U2/L7/U2_L7_Activity_Two.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue