-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchallenge7.java
More file actions
43 lines (43 loc) · 1.88 KB
/
challenge7.java
File metadata and controls
43 lines (43 loc) · 1.88 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
41
42
43
/**
* Write a description of class challenge7 here.
*
* @author (Kate V.)
* @version (June 1st, 2020)
*/
import java.util.Scanner;
public class challenge7
{
public static void main()
{
System.out.println("You are home, and you hear no one. \nYou are walking to the kitchen, and you hear the door closing and locking. You turn around, and you see an unknown man with lab coat and safety goggles. \nYou realize that you cannot get out unless he lets you out. \nHe asks: “Well, hello player! I’m Dr. Haber, and you will not go anywhere until you answer this question correctly. \nCan you turn carbon into diamonds or no?” \n(Answer yes or no)");
Scanner someScanner = new Scanner(System.in);
String answer = someScanner.nextLine();
while(!answer.equals("yes"))
{
if(answer.equals("exit"))
{
System.exit(1);
}
else if(answer.equals("help"))
{
if(Hints.getnumOfHints() == 0)
{
System.out.println("Sorry, but you ran out of hints. Good luck!");
answer = someScanner.nextLine();
}
else
{
System.out.println("Popular science fact that some people find it interesting. Think about how pressure can change the matter");
Hints.numOfHints--;
answer = someScanner.nextLine();
}
}
else
{
System.out.println("He comes to you closer, and you don’t know what he can do. Try again and hurry!");
answer = someScanner.nextLine();
}
}
System.out.println("“Good, you know some stuff. I’m one of the people from Cicada. Nice to meet you. And remember, we are always watching you!” and leaves.");
}
}