回答編集履歴

3

プログラム変更

2020/01/11 06:10

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -52,15 +52,21 @@
52
52
 
53
53
  }
54
54
 
55
+ }
55
56
 
56
57
 
58
+
59
+ public class Main {
60
+
57
- void readIntegerAndCheck() {
61
+ public static void main(String[] args) {
62
+
63
+ Input input = new Input();
58
64
 
59
65
  try {
60
66
 
61
- int num = readInteger();
67
+ int num = input.readInteger();
62
68
 
63
- check(num);
69
+ input.check(num);
64
70
 
65
71
  } catch (NumberFormatException e) {
66
72
 
@@ -76,18 +82,4 @@
76
82
 
77
83
  }
78
84
 
79
-
80
-
81
- public class Main {
82
-
83
- public static void main(String[] args) {
84
-
85
- Input input = new Input();
86
-
87
- input.readIntegerAndCheck();
88
-
89
- }
90
-
91
- }
92
-
93
85
  ```

2

プログラム変更

2020/01/11 06:10

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -36,29 +36,31 @@
36
36
 
37
37
  }
38
38
 
39
+
40
+
41
+ void check(int num) {
42
+
43
+ if (num >= 0) {
44
+
45
+ System.out.println("0以上が入力されました");
46
+
47
+ } else {
48
+
49
+ System.out.println("マイナスの値が入力されました。");
50
+
39
- }
51
+ }
52
+
53
+ }
40
54
 
41
55
 
42
56
 
43
- public class Main {
44
-
45
- public static void main(String[] args) {
57
+ void readIntegerAndCheck() {
46
-
47
- Input input = new Input();
48
58
 
49
59
  try {
50
60
 
51
- int num = input.readInteger();
61
+ int num = readInteger();
52
62
 
53
- if (num >= 0) {
63
+ check(num);
54
-
55
- System.out.println("0以上が入力されました");
56
-
57
- } else {
58
-
59
- System.out.println("マイナスの値が入力されました。");
60
-
61
- }
62
64
 
63
65
  } catch (NumberFormatException e) {
64
66
 
@@ -74,4 +76,18 @@
74
76
 
75
77
  }
76
78
 
79
+
80
+
81
+ public class Main {
82
+
83
+ public static void main(String[] args) {
84
+
85
+ Input input = new Input();
86
+
87
+ input.readIntegerAndCheck();
88
+
89
+ }
90
+
91
+ }
92
+
77
93
  ```

1

定数説明追加

2020/01/11 06:06

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -7,6 +7,8 @@
7
7
  - クラス名は大文字開始、アンダースコアなしにしましょう
8
8
 
9
9
  - メソッド名、ローカル変数名は小文字開始、アンダースコアなしにしましょう
10
+
11
+ - 定数はすべて大文字にしてアンダースコアで接続します
10
12
 
11
13
 
12
14