generated from microsoft/vscode-remote-try-java
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(2.7): finished Unit 2 Lesson 7 acitivities
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |