This commit is contained in:
m-mun
2026-09-09 08:34:32 +09:00
parent 8e67b4ccb9
commit 1b863df929
181 changed files with 34869 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
/*
* 作成 Rhizome
*------------------------------------------------------------
* Copyright(c) Rhizome Inc. All Rights Reserved.
*/
package common;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class FoodUtill {
/**
* fileの中のFoodMenu.csvを読み込んで、
* ArrayList<Food>の形に変換して返す
* @return 料理一覧
*/
public static ArrayList<Food> getFoodList() {
ArrayList<Food> foodList = new ArrayList<>();
try (Scanner scanner = new Scanner(new File("file/FoodMenu.csv"))) {
while(scanner.hasNext()) {
String line = scanner.nextLine();
String[] input = line.split(",");
Food player = new Food(input[0],Integer.parseInt(input[1]));
foodList.add(player);
}
} catch (FileNotFoundException e) {
System.out.println("ファイルが見つかりません");
}
return foodList;
}
}