-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDifficultyLevel.java
More file actions
54 lines (49 loc) · 1.54 KB
/
DifficultyLevel.java
File metadata and controls
54 lines (49 loc) · 1.54 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
45
46
47
48
49
50
51
52
53
54
import java.io.*;
class DifficultyLevel
{
private char level;
public DifficultyLevel()
{
level = 'R';
}
public void setLevel() throws Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String x = "";
System.out.println("Choose Difficulty Level\n\tType:");
do
{
if(!(x == ""))
{
System.out.println("The input enterred is invalid.");
}
System.out.print("\t\tR for Rookie\n\t\tP for Pro\n\t\tE for Expert\n\t\tG for Genius\n\t\t");
x = br.readLine();
x = x.trim();
}
while(!x.equalsIgnoreCase("R")&&!x.equalsIgnoreCase("P")&&!x.equalsIgnoreCase("E")&&!x.equalsIgnoreCase("G"));
level = Character.toUpperCase(x.charAt(0));
if(level == 'R')
{
System.out.println("The difficulty level is set to \"Rookie\". You're good to go,newbie!");
}
else if(level == 'P')
{
System.out.println("The difficulty level is set to \"Pro\". Nice choice, player!");
}
else if(level == 'E')
{
System.out.println("The difficulty level is set to \"Expert\". Brace yourself, champion!");
}
else if(level == 'G')
{
System.out.println("The difficulty level is set to \"Genius\". Way to go, brainy!");
}
Thread.sleep(5000);
Fill.load();
}
public char getLevel()
{
return level;
}
}