-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForgetfulMachine.java
More file actions
32 lines (24 loc) · 953 Bytes
/
ForgetfulMachine.java
File metadata and controls
32 lines (24 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
https://programmingbydoing.com/a/the-forgetful-machine.html
Ask the user for two words and two numbers, and let the person at the keyboard type in some values,
but don't bother storing their responses into any variables.
Again, there is no need to create any variables, except for the Scanner variable typically
named keyboard.
*/
import java.util.Scanner;
class ForgetfulMachine {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("Give me a word!");
keyboard.next();
System.out.println("Give me a second word!");
keyboard.next();
System.out.print("\n");
System.out.println("Great, now your favorite number?");
keyboard.nextInt();
System.out.println("And your second-favorite number...");
keyboard.nextInt();
System.out.print("\n");
System.out.println("Whew! Wasn't that fun?");
}
}