質問編集履歴

2

車のデータを追加しました。

2022/09/14 11:39

投稿

inori333
inori333

スコア4

test CHANGED
File without changes
test CHANGED
@@ -270,6 +270,38 @@
270
270
  }
271
271
 
272
272
 
273
+
274
+
275
+ アルファード,3597000,1,1,1,0,1,0,0,1,1,1
276
+ ハイエース,2903600,1,1,1,0,0,0,0,0,1,0
277
+ プリウス,2597000,1,1,1,0,1,0,1,0,0,0
278
+ ハリアー,2990000,1,1,1,1,1,0,0,0,0,0
279
+ ランドクルーザー,5100000,1,1,1,1,1,0,1,0,1,0
280
+ アクア,1980000,1,1,1,0,0,0,0,0,0,0
281
+ ヴォクシー,3090000,1,1,1,0,1,0,0,0,1,0
282
+ ヴェルファイア,4306000,1,1,1,0,0,0,0,1,1,1
283
+ クラウン,4350000,1,1,1,1,1,1,1,0,0,0
284
+ GR86,2799000,1,1,1,0,1,0,0,0,0,0
285
+ ノア,2670000,1,1,1,0,0,0,0,0,1,0
286
+ シエンタ,1818500,1,1,1,0,0,0,0,0,1,0
287
+ ハイラックス,4312000,1,1,1,0,0,0,0,0,0,0
288
+ RAV4,2774000,1,1,1,0,0,0,0,0,0,0
289
+ ヤリスクロス,1896000,1,1,1,0,0,0,0,0,0,0
290
+ ライズ,1707000,1,1,1,0,1,0,0,0,0,0
291
+ ルーミー,1556500,1,1,1,0,1,0,0,0,0,0
292
+ カローラスポーツ,2169000,1,1,1,0,0,0,0,0,0,0
293
+ パッソ,1265000,1,0,1,0,1,0,0,0,0,0
294
+ カムリ,3495000,1,1,1,1,0,0,0,0,0,0
295
+ カローラフィールダー,1709400,1,1,1,0,0,0,0,0,0,0
296
+ カローラクロス,1999000,1,0,1,0,0,0,0,0,0,0
297
+ カローラツーリング,2013000,1,1,1,0,1,0,0,0,0,0
298
+ スープラ,4995000,1,1,1,1,1,0,0,0,0,0
299
+ C-HR,2792000,1,1,1,0,1,0,0,0,0,0
300
+ MIRAI,7100000,1,1,1,1,1,1,1,0,0,0
301
+ コペン,2382200,1,1,1,0,1,0,0,0,0,0
302
+
303
+
304
+
273
305
  ```
274
306
 
275
307
  ### 試したこと

1

ソースコードの欄にMain.javaを追加し、補足情報を書き直しました。マークダウンについてはよくわからなかったので「-------」を消し、改行のみにしました。

2022/09/14 11:29

投稿

inori333
inori333

スコア4

test CHANGED
File without changes
test CHANGED
@@ -95,7 +95,10 @@
95
95
  }
96
96
  }
97
97
 
98
- ---------------------------------------------------------
98
+
99
+
100
+
101
+
99
102
  import java.util.ArrayList;
100
103
 
101
104
  public class Car_register {
@@ -220,76 +223,52 @@
220
223
  }
221
224
  }
222
225
  }
223
-
226
+ }
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+ import java.util.Scanner;
235
+
236
+ public class Main {
224
- static void carsearch_1(int max, int min){
237
+ public static void main(String[] args){
225
- for(int j = 0; j < 27; j++){
226
- car_data[j] = name.get(j);
227
- car_price[j] = price.get(j);
238
+ CarOption car = new CarOption(args[0]);
228
- car_key[j] = key.get(j);
239
+ car.registration();
229
- car_smart[j] = smart.get(j);
240
+
230
- car_sheet[j] = sheet.get(j);
231
- car_power[j] = power.get(j);
241
+ Scanner sc = new Scanner(System.in);
242
+ System.out.println("/MENU/");
243
+ System.out.println("「0」車一覧「1」検索「2」終了 ");
232
- car_heater[j] = heater.get(j);
244
+ int a = Integer.parseInt(sc.next());
245
+
246
+ while (true) {
247
+ if (a == 0) {
233
- car_cooler[j] = cooler.get(j);
248
+ car.display();
249
+ } else if (a == 1) {
250
+ System.out.println("検索の仕方を選択してください");
251
+ System.out.println("「0」車種名「1」値段「2」オプション");
234
- car_leather[j] = leather.get(j);
252
+ int b = Integer.parseInt(sc.next());
235
- car_ottoman[j] = ottoman.get(j);
236
- car_monitor[j] = monitor.get(j);
253
+ if(b == 0){
237
- car_three[j] = three.get(j);
254
+ car.search_0();
255
+ }else if(b == 1){
256
+ car.search_1();
257
+ }else if(b == 2){
258
+ car.search_2();
259
+ }
260
+ } else if (a == 2) {
261
+ System.out.println("ありがとうございました");
262
+ break;
238
263
  }
239
- for(int i = 0; i < 27; i++){
240
- if(price.get(i) >= min && max > price.get(i)){
264
+ System.out.println("/MENU/");
241
- System.out.println("名前:" + name.get(i) + "," + "値段:" + price.get(i) + "円");
242
- cnt2++;
243
- System.out.println("オプション一覧");
265
+ System.out.println("「0」車一覧「1」検索「2」終了 ");
244
- if(car_key[i] == 1){
245
- System.out.printf("キーレス,");
266
+ a = Integer.parseInt(sc.next());
246
- cnt++;
247
- }
267
+ }
248
- if(car_smart[i] == 1){
249
- System.out.printf("スマートキー,");
250
- cnt++;
268
+ sc.close();
251
- }
269
+ }
252
- if(car_power[i] == 1){
253
- System.out.printf("パワーウィンドウ,");
254
- cnt++;
255
- }
256
- if(car_sheet[i] == 1){
257
- System.out.printf("ベンチシート,");
258
- cnt++;
259
- }
260
- if(car_heater[i] == 1){
261
- System.out.printf("シートヒーター,");
262
- cnt++;
263
- }
264
- if(car_cooler[i] == 1){
265
- System.out.printf("シートクーラー,");
266
- cnt++;
267
- }
268
- if(car_leather[i] == 1){
269
- System.out.printf("本革シート,");
270
- cnt++;
271
- }
272
- if(car_three[i] == 1){
273
- System.out.printf("3列シート,");
274
- cnt++;
275
- }
276
- if(car_monitor[i] == 1){
277
- System.out.println("後席モニター");
278
- cnt++;
279
- }
280
- if(cnt == 0){
281
- System.out.println("オプションはありません");
282
- }
283
- cnt = 0;
284
- }else{
285
- if(cnt2 == 0 && i == 26){
286
- System.out.println("該当する車種は存在しません");
287
- cnt2 = 0;
288
- }
289
- }
290
- }
291
- }
292
270
  }
271
+
293
272
 
294
273
  ```
295
274
 
@@ -298,5 +277,4 @@
298
277
 
299
278
  ### 補足情報(FW/ツールのバージョンなど)
300
279
 
301
- 今回、クラスが2つあるのでソースコードの欄で「------」で区切っています。
280
+
302
-