質問編集履歴

5

追記

2021/08/09 02:38

投稿

KittenMilk
KittenMilk

スコア1

test CHANGED
File without changes
test CHANGED
@@ -16,6 +16,8 @@
16
16
 
17
17
  ```
18
18
 
19
+ java.util.NoSuchElementException
20
+
19
21
  at java.base/java.util.Scanner.throwFor(Scanner.java:937)
20
22
 
21
23
  at java.base/java.util.Scanner.next(Scanner.java:1594)

4

修正

2021/08/09 02:38

投稿

KittenMilk
KittenMilk

スコア1

test CHANGED
File without changes
test CHANGED
@@ -16,7 +16,17 @@
16
16
 
17
17
  ```
18
18
 
19
+ at java.base/java.util.Scanner.throwFor(Scanner.java:937)
20
+
21
+ at java.base/java.util.Scanner.next(Scanner.java:1594)
22
+
23
+ at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
24
+
25
+ at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
26
+
19
- java.util.nosuchelementexception(Gamemanager.75行目)
27
+ at casino.GameManager.start(GameManager.java:75)
28
+
29
+ at casino.Main.main(Main.java:6)
20
30
 
21
31
  ```
22
32
 
@@ -272,17 +282,7 @@
272
282
 
273
283
  ```
274
284
 
275
- at java.base/java.util.Scanner.throwFor(Scanner.java:937)
285
+
276
-
277
- at java.base/java.util.Scanner.next(Scanner.java:1594)
278
-
279
- at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
280
-
281
- at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
282
-
283
- at casino.GameManager.start(GameManager.java:75)
284
-
285
- at casino.Main.main(Main.java:6)
286
286
 
287
287
 
288
288
 

3

エラー分の追加

2021/08/09 02:31

投稿

KittenMilk
KittenMilk

スコア1

test CHANGED
File without changes
test CHANGED
@@ -272,6 +272,22 @@
272
272
 
273
273
  ```
274
274
 
275
+ at java.base/java.util.Scanner.throwFor(Scanner.java:937)
276
+
277
+ at java.base/java.util.Scanner.next(Scanner.java:1594)
278
+
279
+ at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
280
+
281
+ at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
282
+
283
+ at casino.GameManager.start(GameManager.java:75)
284
+
285
+ at casino.Main.main(Main.java:6)
286
+
287
+
288
+
289
+
290
+
275
291
  ### 試したこと
276
292
 
277
293
 

2

コマンドの修正

2021/08/09 02:30

投稿

KittenMilk
KittenMilk

スコア1

test CHANGED
File without changes
test CHANGED
@@ -164,8 +164,6 @@
164
164
 
165
165
  Thread.sleep(2000);
166
166
 
167
- player = BC.start(player);
168
-
169
167
  more = true;
170
168
 
171
169
  break;
@@ -272,7 +270,7 @@
272
270
 
273
271
  }
274
272
 
275
- ---
273
+ ```
276
274
 
277
275
  ### 試したこと
278
276
 

1

コードのすべてを公開しました

2021/08/09 02:19

投稿

KittenMilk
KittenMilk

スコア1

test CHANGED
File without changes
test CHANGED
@@ -28,11 +28,33 @@
28
28
 
29
29
  ```JAVA
30
30
 
31
+ package casino;
32
+
33
+
34
+
35
+ import java.util.Scanner;
36
+
37
+
38
+
39
+ public class GameManager {
40
+
41
+
42
+
43
+ private int coin;
44
+
45
+
46
+
47
+ public GameManager() {
48
+
49
+
50
+
31
- (略)
51
+ }
32
-
52
+
53
+
54
+
33
- public void start() throws Exception{
55
+ public void start() throws Exception{
34
-
56
+
35
- String name;
57
+ String name;
36
58
 
37
59
  int selectA;
38
60
 
@@ -114,9 +136,9 @@
114
136
 
115
137
 
116
138
 
117
- selectA = scanA.nextInt();←エラー箇所
139
+ selectA = scanA.nextInt();
118
-
119
-
140
+
141
+
120
142
 
121
143
  switch(selectA) {
122
144
 
@@ -142,6 +164,8 @@
142
164
 
143
165
  Thread.sleep(2000);
144
166
 
167
+ player = BC.start(player);
168
+
145
169
  more = true;
146
170
 
147
171
  break;
@@ -216,17 +240,39 @@
216
240
 
217
241
  }
218
242
 
219
-
243
+
220
244
 
221
245
  scanA.close();
222
246
 
247
+ }
248
+
249
+
250
+
251
+ public void charA (String text,int sleep) throws Exception {
252
+
253
+ char[] work = new char[text.length()];
254
+
255
+
256
+
257
+ for(int i = 0; i < text.length(); i++){
258
+
259
+ work[i] = text.charAt(i);
260
+
261
+
262
+
263
+ //切り出した文字列を一文字ずつ出力
264
+
265
+ Thread.sleep(sleep);
266
+
267
+ System.out.print(work[i]);
268
+
269
+ }
270
+
271
+ }
272
+
223
273
  }
224
274
 
225
- ```
275
+ ---
226
-
227
-
228
-
229
- (略)
230
276
 
231
277
  ### 試したこと
232
278