質問編集履歴
2
ソースコードの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -64,4 +64,61 @@
|
|
64
64
|
}
|
65
65
|
}
|
66
66
|
|
67
|
+
```
|
68
|
+
変更後
|
69
|
+
```
|
70
|
+
package problems16_2;
|
71
|
+
|
72
|
+
import java.util.InputMismatchException;
|
73
|
+
import java.util.Scanner;
|
74
|
+
|
75
|
+
public class StartUp{
|
76
|
+
|
77
|
+
public static void main(String[] args) {
|
78
|
+
Scanner stdIn = new Scanner(System.in);
|
79
|
+
|
80
|
+
System.out.println("二つの整数値を入力してください。");
|
81
|
+
int a;
|
82
|
+
int b;
|
83
|
+
try {
|
84
|
+
a = stdIn.nextInt();
|
85
|
+
b = stdIn.nextInt();
|
86
|
+
|
87
|
+
MulDiv2.timeNumbers(a, b);
|
88
|
+
MulDiv2.divideNumbers(a, b);
|
89
|
+
}catch(ArithmeticException e) {
|
90
|
+
System.out.println("0での割り算はできません。");
|
91
|
+
|
92
|
+
}catch(InputMismatchException e) {
|
93
|
+
System.out.println("整数値ではありません。");
|
94
|
+
|
95
|
+
}finally {
|
96
|
+
System.out.println("プログラムを終了します。");
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
```
|
105
|
+
```ここに言語を入力
|
106
|
+
package problems16_2;
|
107
|
+
|
108
|
+
public class MulDiv2 {
|
109
|
+
|
110
|
+
static int timeNumbers(int a, int b) {
|
111
|
+
return a*b;
|
112
|
+
}
|
113
|
+
|
114
|
+
static double divideNumbers(int a, int b) {
|
115
|
+
return (double)a/b;
|
116
|
+
}
|
117
|
+
|
118
|
+
static void showResults(int a, int b) {
|
119
|
+
System.out.println(a + " × " + b + " = " + timeNumbers(a,b) );
|
120
|
+
System.out.println(a + " ÷ " + b + " = " + divideNumbers(a,b));
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
67
124
|
```
|
1
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -52,7 +52,6 @@
|
|
52
52
|
```
|
53
53
|
|
54
54
|
```
|
55
|
-
package problems16_2;
|
56
55
|
|
57
56
|
public class MulDiv2 {
|
58
57
|
|