Klasse ingredients gekürzt in List

This commit is contained in:
Madeleine Vigier 2022-12-17 13:32:41 +01:00
parent 61ba486e4f
commit 5f0191d6cd

View File

@ -1,3 +1,5 @@
import java.util.List;
/**
* Menue is a class to built a menue
*
@ -9,86 +11,23 @@ public class Menue {
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;
List<String> ingredients;
/**
* 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
* @param ingredients list of ingredients
*/
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) {
public Menue(String date, String dish, String sideDish, String typ, List<String> ingredients) {
this.date = date;
this.dish = dish;
this.sideDish = sideDish;
this.typ = typ;
this.eggs = eggs;
this.peanuts = peanuts;
this.fish = fish;
this.grains = grains;
this.crustaceans = crustaceans;
this.lupines = lupines;
this.milk = milk;
this.nuts = nuts;
this.sulfurDioxideAndSulfite = sulfurDioxideAndSulfite;
this.celeriac = celeriac;
this.mustards = mustards;
this.sesame = sesame;
this.soy = soy;
this.molluscs = molluscs;
this.antioxidant = antioxidant;
this.artificialColours = artificialColours;
this.flavourEnhancer = flavourEnhancer;
this.preservatives = preservatives;
this.nitrate = nitrate;
this.picklingSalt = picklingSalt;
this.phosphate = phosphate;
this.artificialSweetener = artificialSweetener;
this.ingredients = ingredients;
}
@ -113,115 +52,10 @@ public class Menue {
}
}
public String getEggs() {
if (eggs) {
return "a";
} else {
return "";
}
}
public String getPeanuts() {
if (peanuts) {
return "d";
} else {
return "";
}
}
public String getFish() {
if (fish) {
return "m";
} else {
return "";
}
}
public String getGrains() {
if (grains) {
return "a";
} else {
return "";
}
}
//adjust assignment
public boolean isCrustaceans() {
return crustaceans;
}
public boolean isLupines() {
return lupines;
}
public boolean isMilk() {
return milk;
}
public boolean isNuts() {
return nuts;
}
public boolean isSulfurDioxideAndSulfite() {
return sulfurDioxideAndSulfite;
}
public boolean isCeleriac() {
return celeriac;
}
public boolean isMustards() {
return mustards;
}
public boolean isSesame() {
return sesame;
}
public boolean isSoy() {
return soy;
}
public boolean isMolluscs() {
return molluscs;
}
public boolean isAntioxidant() {
return antioxidant;
}
public boolean isArtificialColours() {
return artificialColours;
}
public boolean isFlavourEnhancer() {
return flavourEnhancer;
}
public boolean isPreservatives() {
return preservatives;
}
public boolean isNitrate() {
return nitrate;
}
public boolean isPicklingSalt() {
return picklingSalt;
}
public boolean isPhosphate() {
return phosphate;
}
public boolean isArtificialSweetener() {
return artificialSweetener;
}
// add allergene and additives
@Override
public String toString() {
return "Montag" + "\t\t\t\t" + dish + "\n" + date + "\t\t\t" + sideDish
+ "\n" + "\t\t\t\t\t" + "Allergene" + "\n " + "\t\t\t\t\t" + getTyp() + "\n";
+ "\n" + "\t\t\t\t\t" + ingredients + "\n " + "\t\t\t\t\t" + getTyp() + "\n"; //replace("[","").replace("]","")
}
}