-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchallenge2.java
More file actions
44 lines (43 loc) · 1.74 KB
/
challenge2.java
File metadata and controls
44 lines (43 loc) · 1.74 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
44
/**
* Write a description of class challenge2 here.
*
* @author (Kate V.)
* @version (May 28th, 2020)
*/
import java.util.Scanner;
public class challenge2
{
public static void main()
{
System.out.println("You are going to a given address and find this message to decrypt:\nYKILQPANOYEAJYA.YKI\nand you know that description relates to -4 (not the message itself). Type your decrypted message here:");
Scanner someScanner = new Scanner(System.in);
String answer = someScanner.nextLine();
while(answer.indexOf("COMPUTERSCIENCE.COM") == -1 && answer.indexOf("computerscience.com") == -1)
{
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("What is a study of processes that interact with data and that can be represented as data in the form of programs? That’s the part of the URL that is being asked");
Hints.numOfHints--;
answer = someScanner.nextLine();
}
}
else
{
System.out.println("You are going to that website, but it tells you that you got stuck since the answer is incorrect. Try again!");
answer = someScanner.nextLine();
}
}
System.out.println("When you go to that website, you get the name of your very good friend from high school Thomas!");
}
}