From ce62929779691d3c092bbf00bc3d9970251391f6 Mon Sep 17 00:00:00 2001 From: pbd2h21avi Date: Thu, 15 Dec 2022 19:37:26 +0100 Subject: [PATCH] methoden angepasst --- src/Menue.java | 123 ++++++++++++++++++++++++++++--------------------- 1 file changed, 71 insertions(+), 52 deletions(-) diff --git a/src/Menue.java b/src/Menue.java index 9019497..b19ea8d 100644 --- a/src/Menue.java +++ b/src/Menue.java @@ -1,10 +1,14 @@ +/** + * 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; - String desertV; - String desert; boolean eggs; boolean peanuts; boolean fish; @@ -28,13 +32,41 @@ public class Menue { boolean phosphate; boolean artificialSweetener; - public Menue(String date, String dish, String sideDish, String typ, String desertV, String desert, boolean eggs, boolean peanuts, boolean fish, boolean grains, boolean crustaceans, boolean lupines, boolean milk, boolean nuts, boolean sulfurDioxideAndSulfite, boolean celeriac, boolean mustards, boolean sesame, boolean soy, boolean molluscs, boolean antioxidant, boolean artificialColours, boolean flavourEnhancer, boolean preservatives, boolean nitrate, boolean picklingSalt, boolean phosphate, boolean artificialSweetener) { + /** + * constructor + * + * @param date date of meal + * @param dish meal + * @param sideDish side dish + * @param typ vegan, vegetarian or meat + * @param eggs allergens + * @param peanuts allergens + * @param fish allergens + * @param grains allergens + * @param crustaceans allergens + * @param lupines allergens + * @param milk allergens + * @param nuts allergens + * @param sulfurDioxideAndSulfite additives + * @param celeriac additives + * @param mustards additives + * @param sesame additives + * @param soy additives + * @param molluscs additives + * @param antioxidant additives + * @param artificialColours additives + * @param flavourEnhancer additives + * @param preservatives additives + * @param nitrate additives + * @param picklingSalt additives + * @param phosphate additives + * @param artificialSweetener additives + */ + public Menue(String date, String dish, String sideDish, String typ, boolean eggs, boolean peanuts, boolean fish, boolean grains, boolean crustaceans, boolean lupines, boolean milk, boolean nuts, boolean sulfurDioxideAndSulfite, boolean celeriac, boolean mustards, boolean sesame, boolean soy, boolean molluscs, boolean antioxidant, boolean artificialColours, boolean flavourEnhancer, boolean preservatives, boolean nitrate, boolean picklingSalt, boolean phosphate, boolean artificialSweetener) { this.date = date; this.dish = dish; this.sideDish = sideDish; this.typ = typ; - this.desertV = desertV; - this.desert = desert; this.eggs = eggs; this.peanuts = peanuts; this.fish = fish; @@ -59,6 +91,7 @@ public class Menue { this.artificialSweetener = artificialSweetener; } + public String getDate() { return date; } @@ -72,31 +105,45 @@ public class Menue { } public String getTyp() { - return typ; + if (typ.equals("DessertV") || typ.equals("Dessert")) { + return ""; + } else { + + return typ; + } } - public String getDesertV() { - return desertV; + public String getEggs() { + if (eggs) { + return "a"; + } else { + return ""; + } + } - public String getDesert() { - return desert; + public String getPeanuts() { + if (peanuts) { + return "d"; + } else { + return ""; + } } - public boolean isEggs() { - return eggs; + public String getFish() { + if (fish) { + return "m"; + } else { + return ""; + } } - public boolean isPeanuts() { - return peanuts; - } - - public boolean isFish() { - return fish; - } - - public boolean isGrains() { - return grains; + public String getGrains() { + if (grains) { + return "a"; + } else { + return ""; + } } public boolean isCrustaceans() { @@ -173,36 +220,8 @@ public class Menue { @Override public String toString() { - return "\t\t\t\tMENÜPLAN\n" + - "Montag\n" + date + "\t" + - ", dish='" + dish + '\'' + - ", sideDish='" + sideDish + '\'' + - ", typ='" + typ + '\'' + - ", desertV='" + desertV + '\'' + - ", desert='" + desert + '\'' + - ", eggs=" + eggs + - ", peanuts=" + peanuts + - ", fish=" + fish + - ", grains=" + grains + - ", crustaceans=" + crustaceans + - ", lupines=" + lupines + - ", milk=" + milk + - ", nuts=" + nuts + - ", sulfurDioxideAndSulfite=" + sulfurDioxideAndSulfite + - ", celeriac=" + celeriac + - ", mustards=" + mustards + - ", sesame=" + sesame + - ", soy=" + soy + - ", molluscs=" + molluscs + - ", antioxidant=" + antioxidant + - ", artificialColours=" + artificialColours + - ", flavourEnhancer=" + flavourEnhancer + - ", preservatives=" + preservatives + - ", nitrate=" + nitrate + - ", picklingSalt=" + picklingSalt + - ", phosphate=" + phosphate + - ", artificialSweetener=" + artificialSweetener + - '}'; + return "Montag\n" + "\t\t\t\t" + dish + "\n" + sideDish + + "Allergene" + "\n" + getTyp(); } }