-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMadlibs.java
More file actions
38 lines (27 loc) · 1.1 KB
/
Madlibs.java
File metadata and controls
38 lines (27 loc) · 1.1 KB
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
33
34
35
36
37
38
import java.util.Scanner;
public class Madlibs {
public static void main(String[] args) {
// Madlibs game
Scanner scanner = new Scanner(System.in);
String adjective1;
String noun1;
String adjective2;
String verb1;
String adjective3;
System.out.print("Enter an adjective (description): ");
adjective1 = scanner.nextLine();
System.out.print("Enter a noun (animal or person): ");
noun1 = scanner.nextLine();
System.out.print("Enter an adjective (description): ");
adjective2 = scanner.nextLine();
System.out.print("Enter a verb (action): ");
verb1 = scanner.nextLine();
System.out.print("Enter an adjective (description): ");
adjective3 = scanner.nextLine();
System.out.println("\nToday I went to a " + adjective1 + " zoo.");
System.out.println("In an exhibit, I saw a " + noun1 + ".");
System.out.println(noun1 + " was " + adjective2 + " and " + verb1 + "!");
System.out.println("I was " + adjective3 + "!");
scanner.close();
}
}