-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBankMenu.java
More file actions
207 lines (187 loc) · 5.62 KB
/
BankMenu.java
File metadata and controls
207 lines (187 loc) · 5.62 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import java.util.Scanner;
public class BankMenu {
private Scanner input;
private Bank bank;
public BankMenu()
{
input = new Scanner(System.in);
bank = new Bank();
runMenu();
}
public static void main(String[] args){
BankMenu app = new BankMenu();
}
private int bankMenu()
{
System.out.println("Bank Menu");
System.out.println("---------");
System.out.println(" 1) Loans");
System.out.println(" 2) Test Sites");
System.out.println(" 3) Drills");
System.out.println(" 4) Concessions");
System.out.println(" 0) Exit");
System.out.print("==>> ");
int option = input.nextInt();
return option;
}
private int loanMenu()
{
System.out.println("Loan's Menu");
System.out.println("------------");
System.out.println(" 1) Request Loan of 1 million");
System.out.println(" 2) Request Loan of 500,000");
System.out.println(" 3) Repay Loan");
System.out.println(" 0) Return to main Bank Menu");
int optionTwo = input.nextInt();
return optionTwo;
}
private int drillMenu()
{
System.out.println("Drill's Menu");
System.out.println("------------");
System.out.println(" 1) Purchase a Drill");
System.out.println(" 2) Sell a Drill");
System.out.println(" 3) Transfer a Drill");
System.out.println(" 4) List Drill Inventory");
System.out.println(" 0) Return to main Bank Menu");
int optionThree = input.nextInt();
return optionThree;
}
private int drillShopMenu()
{
System.out.println("Drill Shop Menu");
System.out.println("------------");
System.out.println(" 1) Purchase a Light Drill for 100,000");
System.out.println(" 2) Purchase a Special Drill for 250,000");
System.out.println(" 3) Purchase a Heavy Drill for 500,000");
System.out.println(" 0) Return to Drill's Menu");
int optionFour = input.nextInt();
return optionFour;
}
private int concMenu()
{
System.out.println("Concession's Menu");
System.out.println("------------");
System.out.println(" 1) Buy a Concession");
System.out.println(" 2) Sell a Concession");
System.out.println(" 0) Return to main Bank Menu");
int optionFive = input.nextInt();
return optionFive;
}
public void runMenu()
{
int option = bankMenu();
while (option != 0)
{
switch (option)
{
case 1: runMenuTwo();
break;
case 2: bank.testSites();
break;
case 3: runMenuThree();
break;
case 4: runMenuFive();
break;
default: System.out.println("Invalid option entered: " + option);
break;
}
System.out.println("\nPress any key to continue...");
input.nextLine();
input.nextLine();
option = bankMenu();
}
}
public void runMenuTwo()
{
int optionTwo = loanMenu();
while (optionTwo != 0)
{
switch(optionTwo)
{
case 1: bank.loan(1000000);
break;
case 2: bank.loan(500000);
break;
case 3: bank.loanRepay();
break;
}
System.out.println("\nPress any key to continue...");
input.nextLine();
input.nextLine();
optionTwo = loanMenu();
}
}
public void runMenuThree()
{
int optionThree = drillMenu();
while (optionThree !=0)
{
switch(optionThree)
{
case 1: runMenuFour();
break;
case 2: bank.sellDrill();
break;
case 3: bank.drillTransfer();
break;
case 4: bank.listInv();
break;
}
System.out.println("\nPress any key to continue...");
input.nextLine();
input.nextLine();
optionThree = loanMenu();
}
}
public void runMenuFour()
{
int optionFour = drillShopMenu();
while (optionFour != 0)
{
switch(optionFour)
{
case 1: bank.drills(1);
break;
case 2: bank.drills(2);
break;
case 3: bank.drills(3);
break;
}
System.out.println("\nPress any key to continue...");
input.nextLine();
input.nextLine();
optionFour = drillShopMenu();
}
}
public void runMenuFive()
{
int optionFive = concMenu();
while (optionFive != 0)
{
switch(optionFive)
{
case 1: bank.buyConc();
break;
case 2: bank.sellConc();
break;
}
System.out.println("\nPress any key to continue...");
input.nextLine();
input.nextLine();
optionFive = concMenu();
}
}
public Scanner getInput() {
return input;
}
public void setInput(Scanner input) {
this.input = input;
}
public Bank getBank() {
return bank;
}
public void setBank(Bank bank) {
this.bank = bank;
}
}