Skip to content

Commit

Permalink
feat(2.7): finished Unit 2 Lesson 7 acitivities
Browse files Browse the repository at this point in the history
  • Loading branch information
101zh committed Sep 27, 2023
1 parent 9fd8aea commit 029d440
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"configurations": [
{
"type": "java",
"name": "U2_L7_Activity_Two",
"request": "launch",
"mainClass": "Unit2.U2_L7_Activity_Two",
"projectName": "my-app"
},
{
"type": "java",
"name": "Test",
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/Unit2/U2_L7_Activity_One.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* Lesson 7 Coding Activity Question 1 */
package Unit2;

public class U2_L7_Activity_One
{
public static void main(String[] args)
{
Integer a = Integer.MAX_VALUE;
a += 1;
System.out.println(a);
Integer b = Integer.MIN_VALUE;
b -= 1;
System.out.println(b);
}
}
26 changes: 26 additions & 0 deletions src/main/java/Unit2/U2_L7_Activity_Three.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// /* Lesson 7 Coding Activity Question 3 */

// 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());
// }
// }
25 changes: 25 additions & 0 deletions src/main/java/Unit2/U2_L7_Activity_Two.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package Unit2;

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("null null");
System.out.println("Enter values:");
System.out.print(">");
x = scan.nextInt();
System.out.print("\n>");
y = scan.nextInt();

Double avg = ((double) x + y) / 2;
System.out.println("Average of " + x + " and " + y + " is " + avg);
scan.close();
}
}

0 comments on commit 029d440

Please sign in to comment.