Unit 2 Lesson 1

This commit is contained in:
End Nightshade 2026-02-02 09:08:29 -07:00
parent de41cde6eb
commit c17245e959
No known key found for this signature in database
2 changed files with 44 additions and 0 deletions

View 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 +
"."
);
}
}

View 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);
}
}