mirror of
https://github.com/System-End/APCSA.git
synced 2026-04-19 16:38:24 +00:00
Unit 2 Lesson 1
This commit is contained in:
parent
de41cde6eb
commit
c17245e959
2 changed files with 44 additions and 0 deletions
24
U2/L1/U2_L1_Activity_One.java
Normal file
24
U2/L1/U2_L1_Activity_One.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/* Lesson 1 Coding Activity Question 1 */
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class U2_L1_Activity_One {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
System.out.println("What is your name?");
|
||||
String name = scanner.nextLine();
|
||||
|
||||
System.out.println("What is your favorite number?");
|
||||
int favoriteNumber = scanner.nextInt();
|
||||
|
||||
System.out.println(
|
||||
"Your name is " +
|
||||
name +
|
||||
" and you like the number " +
|
||||
favoriteNumber +
|
||||
"."
|
||||
);
|
||||
}
|
||||
}
|
||||
20
U2/L1/U2_L1_Activity_Two.java
Normal file
20
U2/L1/U2_L1_Activity_Two.java
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* Lesson 1 Coding Activity Question 2 */
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class U2_L1_Activity_Two {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String order = "apple pie";
|
||||
|
||||
System.out.println("The current order is " + order);
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println(
|
||||
"I want to eat something else, what do you want to eat?"
|
||||
);
|
||||
order = scanner.nextLine();
|
||||
|
||||
System.out.println("The order has changed to " + order);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue