Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tok-chef
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Antoine HAZEBROUCK
tok-chef
Commits
48edc0fe
Commit
48edc0fe
authored
Sep 11, 2024
by
Pronier Julien
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modif consigne et ToString des ingrédients
parent
c5fd52a4
Pipeline
#2882
canceled with stages
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
13 deletions
+23
-13
Application.java
src/main/java/imt/Application.java
+6
-3
Autre.java
src/main/java/imt/ingredients/Autre.java
+1
-1
Epice.java
src/main/java/imt/ingredients/Epice.java
+1
-1
Ingredient.java
src/main/java/imt/ingredients/Ingredient.java
+11
-7
Legume.java
src/main/java/imt/ingredients/Legume.java
+1
-1
ViandePoisson.java
src/main/java/imt/ingredients/ViandePoisson.java
+3
-0
No files found.
src/main/java/imt/Application.java
View file @
48edc0fe
...
...
@@ -16,10 +16,13 @@ public class Application {
Ingredient
ingredient1
=
new
Legume
(
1
,
"Oignons"
,
120
,
false
);
Ingredient
ingredient2
=
new
Legume
(
2
,
"Patate"
,
120
,
false
);
Ingredient
ingredient3
=
new
ViandePoisson
(
3
,
"Poulet"
,
120
,
12
);
ingredient1
.
setConsigne
(
Consigne
.
CUIT
);
ingredient2
.
setConsigne
(
Consigne
.
CUIT
);
ingredient3
.
setConsigne
(
Consigne
.
CUIT
);
Consigne
[]
consignes
=
Consigne
.
values
();
Ingredient
[]
ingredients
=
{
ingredient1
,
ingredient2
,
ingredient3
};
for
(
int
i
=
0
;
i
<=
2
;
i
++){
ingredients
[
i
].
setConsignes
(
consignes
);
}
System
.
out
.
println
(
ingredient1
);
Plat
plat
=
new
Plat
(
1
,
"Oignon Poulet patate"
,
ingredients
);
System
.
out
.
println
(
plat
);
...
...
src/main/java/imt/ingredients/Autre.java
View file @
48edc0fe
...
...
@@ -27,6 +27,6 @@ public class Autre extends Ingredient {
}
public
String
toString
()
{
return
"Autre [calories="
+
calories
+
", bio="
+
bio
+
", idIngredient="
+
getIdIngredient
()
+
", nomIngredient="
+
getNomIngredient
()
+
"]"
;
return
super
.
toString
()
+
" Autre [calories="
+
calories
+
", bio="
+
bio
+
"]"
;
}
}
src/main/java/imt/ingredients/Epice.java
View file @
48edc0fe
...
...
@@ -17,6 +17,6 @@ public class Epice extends Ingredient{
}
public
String
toString
()
{
return
"Epice [bio="
+
bio
+
", idIngredient="
+
getIdIngredient
()
+
", nomIngredient="
+
getNomIngredient
()
+
"]"
;
return
super
.
toString
()
+
" Epice [bio="
+
bio
+
"]"
;
}
}
src/main/java/imt/ingredients/Ingredient.java
View file @
48edc0fe
...
...
@@ -4,13 +4,13 @@ public class Ingredient {
private
int
idIngredient
;
private
String
nomIngredient
;
private
int
quantit
é
;
private
Consigne
consigne
;
private
Consigne
[]
consignes
;
public
Ingredient
(
int
idIngredient
,
String
nomIngredient
)
{
this
.
idIngredient
=
idIngredient
;
this
.
nomIngredient
=
nomIngredient
;
this
.
quantit
é
=
0
;
this
.
consigne
=
null
;
this
.
consigne
s
=
null
;
}
public
int
getIdIngredient
()
{
...
...
@@ -37,15 +37,19 @@ public class Ingredient {
this
.
quantit
é
=
quantit
é
;
}
public
Consigne
getConsigne
()
{
return
consigne
;
public
Consigne
[]
getConsignes
()
{
return
consigne
s
;
}
public
void
setConsigne
(
Consigne
consigne
)
{
this
.
consigne
=
consigne
;
public
void
setConsigne
s
(
Consigne
[]
consignes
)
{
this
.
consigne
s
=
consignes
;
}
public
String
toString
()
{
return
"Ingredient [idIngredient="
+
idIngredient
+
", nomIngredient="
+
nomIngredient
+
"]"
;
String
strConsigne
=
""
;
for
(
int
i
=
0
;
i
<
consignes
.
length
;
i
++)
{
strConsigne
+=
consignes
[
i
].
toString
()+
", "
;
}
return
"Ingredient [idIngredient="
+
idIngredient
+
", nomIngredient="
+
nomIngredient
+
", Consignes="
+
strConsigne
+
"]"
;
}
}
src/main/java/imt/ingredients/Legume.java
View file @
48edc0fe
...
...
@@ -27,6 +27,6 @@ public class Legume extends Ingredient{
}
public
String
toString
()
{
return
"Legume [calories="
+
calories
+
", bio="
+
bio
+
", idIngredient="
+
getIdIngredient
()
+
", nomIngredient="
+
getNomIngredient
()
+
"]"
;
return
super
.
toString
()
+
" Legume [calories="
+
calories
+
", bio="
+
bio
+
"]"
;
}
}
src/main/java/imt/ingredients/ViandePoisson.java
View file @
48edc0fe
...
...
@@ -26,5 +26,8 @@ public class ViandePoisson extends Ingredient{
this
.
gras
=
gras
;
}
public
String
toString
()
{
return
super
.
toString
()
+
" Viande/Poisson [calories="
+
calories
+
", gras="
+
gras
+
"]"
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment