Korrektur der Syntax und einhaltliche toString für das Speichern der Daten.
This commit is contained in:
parent
d858ff8f8d
commit
d2f9ef49c9
@ -188,9 +188,9 @@ public class Data {
|
||||
|
||||
String date = parts[0];
|
||||
String user = parts[1];
|
||||
String mealtyp = parts[3];
|
||||
String deserttyp = parts[5];
|
||||
orderList.add(new Order(date, user, mealtyp, deserttyp));
|
||||
String mealtype = parts[3];
|
||||
String deserttype = parts[5];
|
||||
orderList.add(new Order(date, user, mealtype, deserttype));
|
||||
}
|
||||
return null;//orderList
|
||||
|
||||
@ -207,6 +207,8 @@ public class Data {
|
||||
|
||||
} else if (pathWrite.equals("orders.txt")) {
|
||||
|
||||
} else if (pathWrite.equals("menue.txt")){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ public class Menu {
|
||||
String date;
|
||||
String dish;
|
||||
String sideDish;
|
||||
String typ;
|
||||
String type;
|
||||
List<String> ingredients;
|
||||
|
||||
|
||||
@ -20,14 +20,14 @@ public class Menu {
|
||||
* @param date date of meal
|
||||
* @param dish meal
|
||||
* @param sideDish side dish
|
||||
* @param typ vegan, vegetarian or meat
|
||||
* @param type vegan, vegetarian or meat
|
||||
* @param ingredients list of ingredients
|
||||
*/
|
||||
public Menu(String date, String dish, String sideDish, String typ, List<String> ingredients) {
|
||||
public Menu(String date, String dish, String sideDish, String type, List<String> ingredients) {
|
||||
this.date = date;
|
||||
this.dish = dish;
|
||||
this.sideDish = sideDish;
|
||||
this.typ = typ;
|
||||
this.type = type;
|
||||
this.ingredients = ingredients;
|
||||
}
|
||||
|
||||
@ -47,26 +47,25 @@ public class Menu {
|
||||
* @return typ e.g. Vegan
|
||||
* @author Madeleine Vigier
|
||||
*/
|
||||
public String getTyp() {
|
||||
if (typ.contains("DessertV") || typ.contains("Dessert")) {
|
||||
public String getType() {
|
||||
if (type.contains("DessertV") || type.contains("Dessert")) {
|
||||
return "";
|
||||
} else {
|
||||
|
||||
return typ;
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The method toString() returns a String representation of an object
|
||||
* The method toString() returns a String formated to save in a File
|
||||
*
|
||||
* @return a String with dish, sideDish, list of ingredients and the typ of the menu
|
||||
* @author Madeleine Vigier
|
||||
* @author Madeleine Vigier, Felix Wöstemeyer
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return dish + "\n" + sideDish
|
||||
+ "\n" + ingredients.toString().replace("[", "").replace("]", "") + "\n" + getTyp() + "\n";
|
||||
return date+";"+dish+";"+sideDish+";"+type+";"+ingredients;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,14 +8,19 @@
|
||||
public class Order {
|
||||
String date; //date for the meal, not the day it was ordered
|
||||
String user; //phone number of the user account
|
||||
String mealtyp; //meat, vegi or vegan
|
||||
String deserttyp; //desert or vegan desert
|
||||
String mealtype; //meat, vegi or vegan
|
||||
String desserttype; //desert or vegan desert
|
||||
|
||||
Order (String date, String user, String mealtyp, String deserttyp)
|
||||
Order (String date, String user, String mealtype, String desserttype)
|
||||
{
|
||||
this.date = date;
|
||||
this.user = user;
|
||||
this.mealtyp = mealtyp;
|
||||
this.deserttyp = deserttyp;
|
||||
this.mealtype = mealtype;
|
||||
this.desserttype = desserttype;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return date+";"+user+";"+mealtype+";"+desserttype;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class User {
|
||||
* @param nameParent2 name of the second parent of the child
|
||||
* @param billAddress the address the bill should be sent to
|
||||
* @param phoneNumber phonenumber of one of the parents and also the username
|
||||
* @param nameChildren name of the child
|
||||
* @param nameChildren name of the children
|
||||
* @param password password of the user
|
||||
* @author Madeleine Vigier
|
||||
*/
|
||||
@ -80,13 +80,6 @@ public class User {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"nameParent1='" + nameParent1 + '\'' +
|
||||
", nameParent2='" + nameParent2 + '\'' +
|
||||
", billAddress='" + billAddress + '\'' +
|
||||
", phonenumber='" + phoneNumber + '\'' +
|
||||
", nameChildren='" + nameChildren + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
'}';
|
||||
return nameParent1 + ";" + nameParent2 + ";" + billAddress + ";" + phoneNumber + ";" + nameChildren + ";" + password;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user