-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.java
More file actions
101 lines (78 loc) · 1.5 KB
/
Menu.java
File metadata and controls
101 lines (78 loc) · 1.5 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package MemoryGrid;
import java.io.IOException;
import java.util.Scanner;
public class Menu {
public String description="This class represents the main menu for the system";
private Settings s= new Settings();
private void startgame()
{
System.out.println("Starting the Game...");
String diff;
String mode;
if (Grid.cd==240)
{
diff="Easy";
}
else if (Grid.cd==160)
{
diff="Medium";
}
else
{
diff="Hard";
}
System.out.println("Difficulty level:"+diff);
if (Grid.mode==1)
{
mode="Cranky";
}
else
{
mode="Normal";
}
System.out.println("Mode"+mode);
}
private void endgame()
{
System.out.println("Quitting the game...");
System.exit(0);
}
public int main(User u) throws IOException
{
Scanner scan= new Scanner(System.in);
String choice;
while (true)
{
choice=" ";
System.out.println("Press 1 to start the game");
System.out.println("Press 2 to change settings");
System.out.println("Press 3 to get leaderboard");
System.out.println("Press 4 to end game");
choice =scan.nextLine();
if (choice.equals("1"))
{
startgame();
break;
}
else if (choice.equals("2"))
{
s.main(u);
}
else if (choice.equals("3"))
{
GameSystem.getdata();
}
else if (choice.equals("4"))
{
endgame();
break;
}
else
{
System.out.println("Invalid choice.Try again");
}
}
System.out.println("returning");
return Integer.parseInt(choice);
};
}