質問編集履歴

2

コード修正

2022/07/21 07:11

投稿

oimo0505
oimo0505

スコア22

test CHANGED
File without changes
test CHANGED
@@ -95,9 +95,8 @@
95
95
  new BufferedReader (new InputStreamReader (System.in));
96
96
  String str = br.readLine();
97
97
  String [] splitInput = str.split(" ");
98
- double dnum2 = Integer.parseInt(splitInput[2]);
99
98
  double sum = 0;
100
- if (splitInput[1] == null ) {
99
+ if (splitInput.length == 1 ) {
101
100
  if (str.equals("今日の日付は?")) {
102
101
  System.out.println(year+"年"+month+"月"+day+"日");
103
102
  } else if (str.equals("昨日の日付は?")) {
@@ -106,18 +105,22 @@
106
105
  }
107
106
  if (splitInput[1].equals("たす")){
108
107
  double dnum1 = Integer.parseInt(splitInput[0]);
108
+ double dnum2 = Integer.parseInt(splitInput[2]);
109
109
  sum = dnum1 + dnum2;
110
110
  System.out.println(sum + "です。");
111
111
  } else if (splitInput[1].equals("ひく")){
112
112
  double dnum1 = Integer.parseInt(splitInput[0]);
113
+ double dnum2 = Integer.parseInt(splitInput[2]);
113
114
  sum = dnum1 - dnum2;
114
115
  System.out.println(sum + "です。");
115
116
  } else if (splitInput[1].equals("かける")){
116
117
  double dnum1 = Integer.parseInt(splitInput[0]);
118
+ double dnum2 = Integer.parseInt(splitInput[2]);
117
119
  sum = dnum1 * dnum2;
118
120
  System.out.println(sum + "です。");
119
121
  } else if (splitInput[1].equals("わる")){
120
122
  double dnum1 = Integer.parseInt(splitInput[0]);
123
+ double dnum2 = Integer.parseInt(splitInput[2]);
121
124
  sum = dnum1 / dnum2;
122
125
  System.out.println(sum + "です。");
123
126
  }

1

コードの修正

2022/07/21 07:04

投稿

oimo0505
oimo0505

スコア22

test CHANGED
File without changes
test CHANGED
@@ -81,7 +81,7 @@
81
81
  }
82
82
 
83
83
 
84
- class b extends a {
84
+ class b {
85
85
  public static void main(String [] args)throws IOException{
86
86
  String todayStr = new java.text.SimpleDateFormat("yyyyMMdd").format(new java.util.Date());
87
87
  int todayInt = Integer.parseInt(todayStr);