Commit 3da1b743 authored by Pronier Julien's avatar Pronier Julien

Ajout plat

parent 6f88215f
Pipeline #2878 canceled with stages
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="tok-chef" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" default="true" project-jdk-name="22" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
package imt;
import lombok.Data;
import imt.ingredients.Consigne;
import imt.ingredients.Ingredient;
import imt.ingredients.Legume;
import imt.ingredients.ViandePoisson;
@Data
public class Plat {
private final String something;
private int idPlat;
private String nomPlat;
private Ingredient ingredients[];
public Plat(String something) {
this.something = something;
public Plat(int idPlat, String nomPlat, Ingredient[] ingredients) {
this.idPlat = idPlat;
this.nomPlat = nomPlat;
this.ingredients = ingredients;
}
public Plat() {
something = "";
public int getIdPlat() {
return idPlat;
}
public void setIdPlat(int idPlat) {
this.idPlat = idPlat;
}
public String getNomPlat() {
return nomPlat;
}
public void setNomPlat(String nomPlat) {
this.nomPlat = nomPlat;
}
public Ingredient[] getIngredients() {
return ingredients;
}
public void setIngredients(Ingredient[] ingredients) {
this.ingredients = ingredients;
}
@Override
public String toString() {
StringBuilder ingredientStr = new StringBuilder();
for (Ingredient ingredient : ingredients) {
ingredientStr.append(ingredient.toString());
}
return "Plat [idPlat=" + idPlat + ", nomPlat=" + nomPlat + ", ingredients=" + ingredientStr.toString() + "]";
}
public void main(String[] args) {
Ingredient ingredient1 = new Legume(12,"Oignon",100,false);
ingredient1.setConsigne(Consigne.CUIT);
Ingredient[] ingredients = {ingredient1};
String nomplat = "Oignons grillé";
new Plat(1, nomPlat, ingredients);
}
}
package imt.ingredients;
public enum Consigne {
CRU,
CUIT,
DECOUPE,
ENTIER
}
......@@ -3,10 +3,14 @@ package imt.ingredients;
public class Ingredient {
private int idIngredient;
private String nomIngredient;
private int quantité;
private Consigne consigne;
public Ingredient(int idIngredient, String nomIngredient) {
this.idIngredient = idIngredient;
this.nomIngredient = nomIngredient;
this.quantité = 0;
this.consigne = null;
}
public int getIdIngredient() {
......@@ -25,7 +29,22 @@ public class Ingredient {
this.nomIngredient = nomIngredient;
}
public int getQuantité() {
return quantité;
}
public void setQuantité(int quantité) {
this.quantité = quantité;
}
public Consigne getConsigne() {
return consigne;
}
public void setConsigne(Consigne consigne) {
this.consigne = consigne;
}
public String toString() {
return "Ingredient [idIngredient=" + idIngredient + ", nomIngredient=" + nomIngredient + "]";
}
......
......@@ -4,8 +4,10 @@ public class ViandePoisson extends Ingredient{
private int calories;
private int gras;
public ViandePoisson(int idIngredient, String nomIngredient, Boolean bio) {
public ViandePoisson(int idIngredient, String nomIngredient, int calories, int gras) {
super(idIngredient, nomIngredient);
this.calories = calories;
this.gras = gras;
}
public int getCalories() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment