-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestionaire.java
More file actions
40 lines (28 loc) · 1.04 KB
/
Questionaire.java
File metadata and controls
40 lines (28 loc) · 1.04 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
39
40
import java.util.Scanner;
public class Questionaire {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String[] questions = {
"1. Is the sky blue?",
"2. Do cats bark?",
"3. Is water wet?",
"4. Do fish live in the ocean?",
"5. Can birds fly?",
"6. Is fire cold?",
"7. Do apples grow on trees?",
"8. Is 2 + 2 = 4?",
"9. Can you eat rocks?",
"10. Is the sun hot?"
};
System.out.println("Choose 'true' or 'false' for the following questions:");
for (String question : questions) {
System.out.println(question);
String choice = input.next().toLowerCase();
if (!choice.equals("true") && !choice.equals("false")) {
System.out.println("Oops! That's not a valid answer. Try again.");
}
}
System.out.println("You're done! That was fun!");
}
}
i