diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/menue.txt b/menue.txt new file mode 100644 index 0000000..95a3b64 --- /dev/null +++ b/menue.txt @@ -0,0 +1,20 @@ +12.12.2022;Veganes Schnitzel;mit Kroketten und Gemüse;Vegan;x;;;;;;x;;;;x;;;;;;;x;;;;;x +12.12.2022;Vegane Waffel;mit Puderzucker;Dessert V;;;x;;x;;;;;x;;;;;;;x;;;;;;x +12.12.2022;Schnitzel;mit Kroketten, Gemüse und Soße;Fleisch;;;x;;;;;x;;;x;;;;;;;;x;;;;x +12.12.2022;Wackelpudding;mit Vanillesoße;Dessert;;;x;;;;;x;;;;;;;;x;;;;;x;;x +13.12.2022;Rote Linsen Curry;mit Süßkartoffeln;Vegan;;;x;;;;;;;;x;;;;;;x;;;;;;x +13.12.2022;Vegane Pancakes;mit Ahornsirup;Dessert V;x;;;;x;;;;x;;;;;x;;;;;;;;;x +13.12.2022;Gebratene Nudeln;mit Gemüse;Vegetarisch;;;;;;x;;;x;;x;;x;;;x;;;;;;;x +13.12.2022;Berliner;mit Erdbeerfüllung;Dessert;;;x;;;x;;;;x;;;;;x;;;;;x;;;x +14.12.2022;Bratkartoffeln;mit veganer Bratensoße;Vegan;;x;;;;x;;;;;;x;;;;;x;;;;;;x +14.12.2022;Pudding;mit Schokostreuseln;Dessert V;x;;x;;;x;;;x;;;;;;;x;;;;;;;x +14.12.2022;Bratkartoffeln;mit Leberkäse und Ei;Fleisch;;;;x;;x;;;x;;;;x;;;;;;;;;;x +14.12.2022;Pudding;mit Vanillesoße;Dessert;;;x;;;x;;x;;;x;;;;;;x;;;;;;x +15.12.2022;Bauerntopf;mit veganem Hack;Vegan;;x;;;;;;;;;x;;;;x;;;;x;;;;x +15.12.2022;Bananenbrot;mit Datteln;DessertV;;;x;;;x;;;;x;;;;;x;;;;;;;;x +15.12.2022;Bauerntopf;mit veganem Hack;Vegan;;x;;;;;;;;;x;;;;x;;;;x;;;;x +15.12.2022;Bananenbrot;mit Datteln;DessertV;;;x;;;x;;;;x;;;;;x;;;;;;;;x +16.12.2022;Bauerntopf;mit veganem Hack;Vegan;;x;;;;;;;;;x;;;;x;;;;x;;;;x +16.12.2022;Bananenbrot;mit Datteln;DessertV;;;x;;;x;;;;x;;;;;x;;;;;;;;x +16.12.2022;Bauerntopf;mit veganem Hack;Vegan;;x;;;;;;;;;x;;;;x;;;;x;;;;x +16.12.2022;Bananenbrot;mit Datteln;DessertV;;;x;;;x;;;;x;;;;;x;;;;;;;;x \ No newline at end of file diff --git a/out/production/VPR_SCRIPT/Data.class b/out/production/VPR_SCRIPT/Data.class new file mode 100644 index 0000000..54ef9a1 Binary files /dev/null and b/out/production/VPR_SCRIPT/Data.class differ diff --git a/out/production/VPR_SCRIPT/Execute.class b/out/production/VPR_SCRIPT/Execute.class index 170b740..26680c8 100644 Binary files a/out/production/VPR_SCRIPT/Execute.class and b/out/production/VPR_SCRIPT/Execute.class differ diff --git a/out/production/VPR_SCRIPT/GeneralMethods.class b/out/production/VPR_SCRIPT/GeneralMethods.class index 2ad1d63..3aebd84 100644 Binary files a/out/production/VPR_SCRIPT/GeneralMethods.class and b/out/production/VPR_SCRIPT/GeneralMethods.class differ diff --git a/out/production/VPR_SCRIPT/Menue.class b/out/production/VPR_SCRIPT/Menue.class new file mode 100644 index 0000000..10da297 Binary files /dev/null and b/out/production/VPR_SCRIPT/Menue.class differ diff --git a/out/production/VPR_SCRIPT/Order.class b/out/production/VPR_SCRIPT/Order.class new file mode 100644 index 0000000..9b1f762 Binary files /dev/null and b/out/production/VPR_SCRIPT/Order.class differ diff --git a/out/production/VPR_SCRIPT/User.class b/out/production/VPR_SCRIPT/User.class new file mode 100644 index 0000000..cffb6de Binary files /dev/null and b/out/production/VPR_SCRIPT/User.class differ diff --git a/src/Data.java b/src/Data.java new file mode 100644 index 0000000..68a00ed --- /dev/null +++ b/src/Data.java @@ -0,0 +1,239 @@ +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.sql.Array; +import java.util.ArrayList; +import java.util.List; + +/** + * Data is a class to edit files. + * + * @author Madeleine Vigier + * @version 1.3 + */ +public class Data { + private String pathRead; + + public Data(String pathRead) { + this.pathRead = pathRead; + } + + /** + * readUser() is a method to split user.txt into lines and save them in an arraylist + * + * @return Arraylist userList + * @author Madeleine Vigier, Sabine Gubitz + * @version 1.3 + */ + public ArrayList readUser() { + List rows = getRows(); + ArrayList userList = new ArrayList<>(); + + for (String row : rows) { + String[] parts = row.split(";"); + + String nameParent1 = parts[0]; + String nameParent2 = parts[1]; + String billAddress = parts[2]; + String phonenumber = parts[3]; + String nameChildren = parts[4]; + String password = parts[5]; + userList.add(new User(nameParent1, nameParent2, billAddress, phonenumber, nameChildren, password)); + } + return userList; + + } + + + /** + * readMenue() is a method to split menue.txt into lines and save them in an arraylist + * + * @return Arraylist menuelist + * @author Madeleine Vigier, Sabine Gubitz + * @version 1.3 + */ + public ArrayList readMenue() { + + List rows = getRows(); + ArrayList menueList = new ArrayList<>(); + + + for (String row : rows) { + + String[] parts = row.split(";"); + + + String date = parts[0]; + String dish = parts[1]; + String sideDish = parts[2]; + String typ = parts[3]; + String ingredient = parts[4]; + + List ingredients = new ArrayList<>(); + + if (!ingredient.isEmpty()) { + ingredients.add("a"); //eggs + } + + ingredient = parts[5]; + if (!ingredient.isEmpty()) { + ingredients.add("d"); //peanuts + } + ingredient = parts[6]; + if (!ingredient.isEmpty()) { + ingredients.add("m"); //fish + } + ingredient = parts[7]; + if (!ingredient.isEmpty()) { + ingredients.add("g"); //grains + } + ingredient = parts[8]; + if (!ingredient.isEmpty()) { + ingredients.add("f"); //crustaceans + } + ingredient = parts[9]; + if (!ingredient.isEmpty()) { + ingredients.add("n"); //lupines + } + ingredient = parts[10]; + if (!ingredient.isEmpty()) { + ingredients.add("c"); //milk + } + ingredient = parts[11]; + if (!ingredient.isEmpty()) { + ingredients.add("k"); //nuts + } + ingredient = parts[12]; + if (!ingredient.isEmpty()) { + ingredients.add("j"); //sulfurDioxideAndSulfite + } + ingredient = parts[13]; + + if (!ingredient.isEmpty()) { + ingredients.add("l"); //celeriac + } + ingredient = parts[14]; + if (!ingredient.isEmpty()) { + ingredients.add("h"); //mustards + } + ingredient = parts[15]; + if (!ingredient.isEmpty()) { + ingredients.add("i"); //sesame + } + ingredient = parts[16]; + if (!ingredient.isEmpty()) { + ingredients.add("b");//soy + } + ingredient = parts[17]; + if (!ingredient.isEmpty()) { + ingredients.add("e");//molluscs + } + ingredient = parts[18]; + if (!ingredient.isEmpty()) { + ingredients.add("4"); //antioxidant + } + ingredient = parts[19]; + if (!ingredient.isEmpty()) { + ingredients.add("5"); + } + ingredient = parts[20]; + if (!ingredient.isEmpty()) { + ingredients.add("6"); //flavourEnhancer + } + ingredient = parts[21]; + if (!ingredient.isEmpty()) { + ingredients.add("8"); // preservatives + } + ingredient = parts[22]; + + if (!ingredient.isEmpty()) { + ingredients.add("3"); //nitrate + } + ingredient = parts[23]; + if (!ingredient.isEmpty()) { + ingredients.add("1");//picklingSalt + } + ingredient = parts[24]; + if (!ingredient.isEmpty()) { + ingredients.add("7"); //artificialSweetener + } + ingredient = parts[25]; + if (!ingredient.isEmpty()) { + ingredients.add("2"); //phosphate + + } + String end = parts[26]; //endpoint + + menueList.add(new Menue(date, dish, sideDish, typ, ingredients)); + } + return menueList; + } + + + /** + * readOrder() is a method to split order.txt into lines and save them in an arraylist + * + * @return Arraylist orderlist + * @author Madeleine Vigier, Sabine Gubitz + * @version 1.2 + */ + public ArrayList readOrder() { + + ArrayList orderList = new ArrayList<>(); + List rows = getRows(); + + for (String row : rows) { + String[] parts = row.split(";"); + + String date = parts[0]; + String meat = parts[1]; + String meatCount = parts[2]; + String vegi = parts[3]; + String vegiCount = parts[4]; + String vegan = parts[5]; + String veganCount = parts[6]; + String desertV = parts[7]; + String desertVCount = parts[8]; + String desert = parts[9]; + String desertCount = parts[10]; + //orderList.add(new Order(date, meat, meatCount,vegi, vegiCount, vegan, veganCount, desertV, + // desertVCount, desert, desertCount)) + } + return null;//orderList + + } + + /** + * The method writeData writes the data of a List into a txt file. + * + * @param pathWrite determines the filename of the file that will be written + * @param listToWrite determines which ArrayList is to be used for writing the file + */ + public void writeData(String pathWrite, ArrayList listToWrite) { + if (pathWrite.equals("users.txt")) { + + } else if (pathWrite.equals("orders.txt")) { + + } + } + + /** + * The method gets the rows by reading all lines of the path + * + * @return ArrayList rows + * @author Madeleine Vigier + * @version 1.0 + */ + private List getRows() { + Path path = Paths.get(pathRead); + List rows = new ArrayList<>(); + try { + rows = Files.readAllLines(path); + } catch (IOException e) { + e.printStackTrace(); + } + return rows; + } +} + diff --git a/src/Datei.java b/src/Datei.java deleted file mode 100644 index 1e85ab3..0000000 --- a/src/Datei.java +++ /dev/null @@ -1,66 +0,0 @@ -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; - -public class Datei { - private String dataName; - - public Datei(String dataName) { - this.dataName = dataName; - } - - public User[] laden() { - - Path pfad = Paths.get(dataName); - - - try { - List zeilen = Files.readAllLines(pfad); - User[] userListe = new User[zeilen.size()]; - - for (int i = 0; i < zeilen.size(); i++) { - - String[] teile = zeilen.get(i).split(":"); - - String nameParent1 = teile[0]; - String nameParent2 = teile[1]; - String billAddress = teile[2]; - String phonenumber = teile[3]; - String nameChildren = teile[4]; - String password = teile[5]; - - - userListe[i] = new User(nameParent1, nameParent2, billAddress, phonenumber, nameChildren, password); - - - } - - return userListe; - } catch (IOException e) { - e.printStackTrace(); - } - - return null; - } - -// public void speichern(Farbe[] farben, String dateiName) { -// -// Path pfad = Paths.get(dateiname); -// -// List zeilen = new ArrayList<>(); -// for (Farbe farbe : farben) { -// zeilen.add(farbe.formatieren()); -// -// } -// try { -// Files.write(pfad, zeilen); -// } catch (IOException e) { -// e.printStackTrace(); -// } - - -// } - -} diff --git a/src/Execute.java b/src/Execute.java index 6b10c93..215a48b 100644 --- a/src/Execute.java +++ b/src/Execute.java @@ -2,57 +2,84 @@ import java.util.ArrayList; import java.util.Scanner; /** - * The class Execute is the executen file for the whole programm. + * The class Execute is the execution file for the whole program. */ public class Execute { public static void main(String[] args) { - Datei datei = new Datei("user.txt"); - User[] user = datei.laden(); +//EXECUTE MENUE OVERVIEW + Data data = new Data("menue.txt"); + ArrayList menue = data.readMenue(); - for (User user1 : user) { - System.out.println(user1); + for (int i = 0; i < menue.size(); i++) { + if (i % 4 == 0) { + System.out.println(); + System.out.println("--------------------------------------"); + System.out.println(GeneralMethods.getDayNumberNew(menue.get(i).getDate())); + System.out.println(menue.get(i).getDate()); + System.out.println(); + } + System.out.println(menue.get(i)); } - System.out.println(); - System.out.println("\t\t\tANMELDUNG"); - int i = 0; - Scanner leser = new Scanner(System.in); - while (true) { - - System.out.print("Name: "); - boolean error = false; - String name = leser.nextLine(); - if(name.isEmpty()){ - error = true; - } - System.out.print("Passwort: "); - String password = leser.nextLine(); - if(password.isEmpty()){ - error = true; - } - - - for (User user1 : user) { - if (!error) { - if (user1.getPassword().equals(password) && user1.getPhonenumber().equals(name)) { - System.out.println(); - System.out.println("Herzlich Willkommen " + user1.getNameParent1() + " und " + user1.getNameParent2() + ", Ihr Login war erfolgreich!"); - i++; - break; - - } else if (!(user1.getPassword().equals(password) && user1.getPhonenumber().equals(name))) { - System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut."); - break; - } - - }else{ - System.out.println("Bitte Anmeldedaten angeben."); - break; - } - } - if (i > 0) { - break; - } - } + System.out.println("a: Eier; b: Soja, c: Milch; d: Erdnüsse; e: Weichtiere; f: Krebstiere; g: Getreide; h: Senf\n" + + "i: Sesam; j: Schwefeldioxid und Sulfit; k: Nüsse; l: Sellerie; m: Fische; n: Lupinen\n" + + "1: Nitrit-Pökelsalz; 2: Phosphat; 3: Nitrat; 4: Antioxidationsmittel; 5: Farbstoff;\n" + + "6: Geschmacksverstärker; 7: Süßungsmittel; 8: Konservierungsstoff"); } + + //EXECUTE LOGIN +// Data datei = new Data("users.txt"); +// ArrayList user = datei.readUser(); +// +// for (User user1 : user) { +// System.out.println(user1); +// } +// System.out.println(); +// System.out.println("\t\t\tANMELDUNG"); +// int i = 0; +// Scanner leser = new Scanner(System.in); +// +// while (true) { +// +// +// System.out.print("Name: "); +// boolean error = false; +// String name = leser.nextLine(); +// error = isError(error, name); +// System.out.print("Passwort: "); +// String password = leser.nextLine(); +// error = isError(error, password); +// +// +// for (User user1 : user) { +// if (!error) { +// if (user1.getPassword().equals(password) && user1.getPhonenumber().equals(name)) { +// System.out.println(); +// System.out.println("Herzlich Willkommen " + user1.getNameParent1() + " und " + user1.getNameParent2() + ", Ihr Login war erfolgreich!"); +// +// i++; +// break; +// +// } else if (!(user1.getPassword().equals(password) && user1.getPhonenumber().equals(name))) { +// System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut."); +// break; +// } +// +// }else{ +// System.out.println("Bitte Anmeldedaten angeben."); +// break; +// } +// } +// if (i > 0) { +// break; +// } +// } +// } +// +// private static boolean isError(boolean error, String name) { +// if (name.isEmpty()) { +// error = true; +// } +// return error; +// } } diff --git a/src/GeneralMethods.java b/src/GeneralMethods.java index cfa8924..9dda686 100644 --- a/src/GeneralMethods.java +++ b/src/GeneralMethods.java @@ -4,120 +4,171 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; +import java.util.Locale; -/**GeneralMethods is a class for commen public methods. - * - * @auhtor Felix Wöstemeyer +/** + * GeneralMethods is a class for commen public methods. * * @version 1.0 + * @auhtor Felix Wöstemeyer */ public class GeneralMethods { - /**The method writeData saves the given data to a certain file. + + /** + * The method getDayNumberNew() gets the Number of day in week * - * @param pathWrite the given filepath to write - * @param data the data to be saved + * @param dateString date as String e.g. 12.12.2022 + * @return the Number of day in week + * @version 1.0 + * @author Madeleine Vigier */ - public static void writeData(String pathWrite, ArrayList data){ - try{ - BufferedWriter writer = new BufferedWriter(new FileWriter(pathWrite)); - for (String d : data) { - writer.write(d); - writer.newLine(); - } - writer.close(); - } catch (IOException e) { - e.printStackTrace(); - } + public static String getDayNumberNew(String dateString) { + //https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy"); + formatter = formatter.withLocale(Locale.GERMANY); // Locale specifies human language for translating, and cultural norms for lowercase/uppercase and abbreviations and such. Example: Locale.US or Locale.CANADA_FRENCH + LocalDate date = LocalDate.parse(dateString, formatter); + + DayOfWeek day = date.getDayOfWeek(); + return getDayName(day.getValue()); } /** - * Author: Sabine Gubitz - *ddd - * The method read Data interprets a file and returns an useable list for other methods. - * Files to be read have to use : as a divider between attributes + * The method getDayName() gets the weekday * - * @param pathRead determines the filename of the file that will be read - * @return menueList, userList, orderList depending on Data read + * @param dayNumber dayNumber e.g. 1 for Monday + * @return weekday + * @version 1.0 + * @author Madeleine Vigier */ - public static ArrayList readData(String pathRead) { - Path path = Paths.get(pathRead); - - try { - List rows = Files.readAllLines(path); - - if (pathRead.equals("menue.txt")) { - ArrayList menueList = new ArrayList<>(); - - for (String row : rows) { - String[] parts = row.split(":"); - - String day = parts[0]; - String date = parts[1]; - String meat = parts[2]; - String vegi = parts[3]; - String vegan = parts[4]; - String desert1 = parts[5]; - String desert2 = parts[6]; - menueList.add(day + "," + date + "," + meat + "," + vegi + "," + vegan + "," + desert1 + "," + desert2); - } - return menueList; - - } else if (pathRead.equals("users.txt")){ - ArrayList userList = new ArrayList<>(); - - for (String row : rows) { - String[] parts = row.split(":"); - - String nameParent1 = parts[0]; - String nameParent2 = parts[1]; - String billAddress = parts[2]; - String phonenumber = parts[3]; - String nameChildren = parts[4]; - String password = parts[5]; - } - return userList; - - } else if (pathRead.equals("orders.txt")) { - ArrayList orderList = new ArrayList<>(); - - for (String row : rows) { - String[] parts = row.split(":"); - - String date = parts[0]; - String meat = parts[1]; - String meatCount = parts[2]; - String vegi = parts[3]; - String vegiCount = parts[4]; - String vegan = parts[5]; - String veganCount = parts[6]; - String desert1 = parts[7]; - String desert1Count = parts[8]; - String desert2 = parts[9]; - String desert2Count = parts[10]; - } - return orderList; - - } - } catch (IOException e) { - e.printStackTrace(); + public static String getDayName(int dayNumber) { + if (dayNumber == 1) { + return "Montag"; } + if (dayNumber == 2) { + return "Dienstag"; + } + if (dayNumber == 3) { + return "Mittwoch"; + } + if (dayNumber == 4) { + return "Donnerstag"; + } + if (dayNumber == 5) { + return "Freitag"; + } + return null; } - - /** - * The method writeData writes the data of a List into a txt file. - * @param pathWrite determines the filename of the file that will be written - * @param listToWrite determines which ArrayList is to be used for writing the file - */ - public void writeData2 (String pathWrite, ArrayList listToWrite){ - if (pathWrite.equals("users.txt")) { - - } else if (pathWrite.equals("orders.txt")) { - - } - } +// /**The method writeData saves the given data to a certain file. +// * +// * @param pathWrite the given filepath to write +// * @param data the data to be saved +// */ +// public static void writeData(String pathWrite, ArrayList data){ +// try{ +// BufferedWriter writer = new BufferedWriter(new FileWriter(pathWrite)); +// for (String d : data) { +// writer.write(d); +// writer.newLine(); +// } +// writer.close(); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } +// +// /** +// * Author: Sabine Gubitz +// *ddd +// * The method read Data interprets a file and returns an useable list for other methods. +// * Files to be read have to use : as a divider between attributes +// * +// * @param pathRead determines the filename of the file that will be read +// * @return menueList, userList, orderList depending on Data read +// */ +// public static ArrayList readData(String pathRead) { +// Path path = Paths.get(pathRead); +// +// try { +// List rows = Files.readAllLines(path); +// +// if (pathRead.equals("menue.txt")) { +// ArrayList menueList = new ArrayList<>(); +// +// for (String row : rows) { +// String[] parts = row.split(":"); +// +// String day = parts[0]; +// String date = parts[1]; +// String meat = parts[2]; +// String vegi = parts[3]; +// String vegan = parts[4]; +// String desert1 = parts[5]; +// String desert2 = parts[6]; +// menueList.add(day + "," + date + "," + meat + "," + vegi + "," + vegan + "," + desert1 + "," + desert2); +// } +// return menueList; +// +// } else if (pathRead.equals("users.txt")){ +// ArrayList userList = new ArrayList<>(); +// +// for (String row : rows) { +// String[] parts = row.split(":"); +// +// String nameParent1 = parts[0]; +// String nameParent2 = parts[1]; +// String billAddress = parts[2]; +// String phonenumber = parts[3]; +// String nameChildren = parts[4]; +// String password = parts[5]; +// } +// return userList; +// +// } else if (pathRead.equals("orders.txt")) { +// ArrayList orderList = new ArrayList<>(); +// +// for (String row : rows) { +// String[] parts = row.split(":"); +// +// String date = parts[0]; +// String meat = parts[1]; +// String meatCount = parts[2]; +// String vegi = parts[3]; +// String vegiCount = parts[4]; +// String vegan = parts[5]; +// String veganCount = parts[6]; +// String desert1 = parts[7]; +// String desert1Count = parts[8]; +// String desert2 = parts[9]; +// String desert2Count = parts[10]; +// } +// return orderList; +// +// } +// } catch (IOException e) { +// e.printStackTrace(); +// } +// return null; +// } +// +// +// /** +// * The method writeData2 writes the data of a List into a txt file. +// * @param pathWrite determines the filename of the file that will be written +// * @param listToWrite determines which ArrayList is to be used for writing the file +// */ +// public void writeData2 (String pathWrite, ArrayList listToWrite){ +// if (pathWrite.equals("users.txt")) { +// +// } else if (pathWrite.equals("orders.txt")) { +// +// } +// } } diff --git a/src/Menue.java b/src/Menue.java new file mode 100644 index 0000000..1df6d0f --- /dev/null +++ b/src/Menue.java @@ -0,0 +1,75 @@ +import java.util.List; + +/** + * Menue is a class to built a menue + * + * @author: Madeleine Vigier + * @version: 1.0 + */ +public class Menue { + String date; + String dish; + String sideDish; + String typ; + List ingredients; + + + /** + * constructor + * + * @param date date of meal + * @param dish meal + * @param sideDish side dish + * @param typ vegan, vegetarian or meat + * @param ingredients list of ingredients + */ + public Menue(String date, String dish, String sideDish, String typ, List ingredients) { + this.date = date; + this.dish = dish; + this.sideDish = sideDish; + this.typ = typ; + this.ingredients = ingredients; + } + + /** + * The method get Date() gets the date + * + * @return date + * @author Madeleine Vigier + * @version 1.0 + */ + public String getDate() { + return date; + } + + /** + * The method getTyp() gets the typ of the meal + * + * @return typ e.g. Vegan + * @author Madeleine Vigier + * @version 1.0 + */ + public String getTyp() { + if (typ.contains("DessertV") || typ.contains("Dessert")) { + return ""; + } else { + + return typ; + } + } + + + /** + * The method toString() returns a String representation of an object + * + * @return a String with dish, sideDish, list of ingredients and the typ of the menue + * @author Madeleine Vigier + * @version 1.0 + */ + @Override + public String toString() { + return dish + "\n" + sideDish + + "\n" + ingredients.toString().replace("[", "").replace("]", "") + "\n" + getTyp() + "\n"; + } +} + diff --git a/src/Order.java b/src/Order.java new file mode 100644 index 0000000..a4d1920 --- /dev/null +++ b/src/Order.java @@ -0,0 +1,2 @@ +public class Order { +} diff --git a/src/User.java b/src/User.java index 96ec52c..e9e4e98 100644 --- a/src/User.java +++ b/src/User.java @@ -1,3 +1,9 @@ +/** + * User class creates User Objects + * + * @author Madeleine Vigier + * @version 1.1 + */ public class User { private String nameParent1; private String nameParent2; @@ -6,6 +12,18 @@ public class User { private String nameChildren; private String password; + /** + * constructor + * + * @param nameParent1 + * @param nameParent2 + * @param billAddress + * @param phonenumber + * @param nameChildren + * @param password + * @author Madeleine Vigier + * @version 1.0 + */ public User(String nameParent1, String nameParent2, String billAddress, String phonenumber, String nameChildren, String password) { this.nameParent1 = nameParent1; this.nameParent2 = nameParent2; @@ -15,22 +33,57 @@ public class User { this.password = password; } + /** + * the method getPhonenumber() gets the Phonenumber + * + * @return Phonenumber + * @author Madeleine Vigier + * @version 1.0 + */ public String getPhonenumber() { return phonenumber; } + /** + * the method getPassword() gets the password + * + * @return password + * @author Madeleine Vigier + * @version 1.0 + */ public String getPassword() { return password; } + /** + * the method getNameParent1() gets nameParent1 + * + * @return nameParent1 + * @author Madeleine Vigier + * @version 1.0 + */ public String getNameParent1() { return nameParent1; } + /** + * the method getNameParent2() gets nameParent2 + * + * @return nameParent2 + * @author Madeleine Vigier + * @version 1.0 + */ public String getNameParent2() { return nameParent2; } + /** + * the methode toString() returns a String representation of an object + * + * @return a String with nameParent1, nameparent2, billAdress, phonenumber, nameChildren, password + * @author Madeleine Vigier + * @version 1.0 + */ @Override public String toString() { return "User{" + diff --git a/user.txt b/user.txt index 618fa76..070c533 100644 --- a/user.txt +++ b/user.txt @@ -1,2 +1,2 @@ -Felix Düsterhaus:Sabine Gubitz:Detmolderstrasse 101,33102 Paderborn:1234567:Lisa,Peter:12345 -Kevin Pfannenstiel:Marlene Pfannenstiel:Fürstenallee 30, 33102 Paderborn:7654321:Anton:12345 +Felix Düsterhaus;Sabine Gubitz;Detmolderstrasse 101,33102 Paderborn;1234567;Lisa,Peter;12345 +Kevin Pfannenstiel;Marlene Pfannenstiel;Fürstenallee 30, 33102 Paderborn;7654321;Anton;12345