Skip to content
Snippets Groups Projects
Commit 46fd75b1 authored by benjamin.sitbon's avatar benjamin.sitbon
Browse files

Lab3-Task1 et 2

parent cd0ec10b
No related branches found
No related tags found
No related merge requests found
Showing
with 147 additions and 0 deletions
public class LegumeCuisson implements Legume {
}
\ No newline at end of file
File added
public class LegumePotage implements Legume {
}
\ No newline at end of file
File added
public class LegumeSalades implements Legume {
}
\ No newline at end of file
File added
public class LegumeVapeur implements Legume {
}
\ No newline at end of file
File added
import java.util.ArrayList;
public abstract class Menu {
ArrayList<Ingredient> menu = new ArrayList<>();
public abstract void add(Herbe he);
public abstract void add(Huile hu);
public abstract void add(Legume l);
public abstract void addAll(Ingredient... ingredients);
public abstract Ingredient get(int index);
}
\ No newline at end of file
File added
public class MenuCuisson extends Menu {
public void add(Legume l){
LegumeCuisson cuiss = (LegumeCuisson) l;
this.menu.add(cuiss);
}
public void add(Herbe he){
HerbeCuisson cuiss = (HerbeCuisson) he;
this.menu.add(cuiss);
}
public void add(Huile hu){
HuileCuisson cuiss = (HuileCuisson) hu;
this.menu.add(cuiss);
}
public void addAll(Ingredient... ingredients){
for(Ingredient l: ingredients){
this.menu.add(l);
}
}
public Ingredient get(int index){
return this.menu.get(index);
}
}
\ No newline at end of file
File added
public class MenuPotage extends Menu {
public void add(Legume l){
LegumePotage pot = (LegumePotage) l;
this.menu.add(pot);
}
public void add(Herbe he){
HerbePotage pot = (HerbePotage) he;
this.menu.add(pot);
}
public void add(Huile hu){
HuilePotage pot = (HuilePotage) hu;
this.menu.add(pot);
}
public void addAll(Ingredient... ingredients){
for(Ingredient l: ingredients){
this.menu.add(l);
}
}
public Ingredient get(int index){
return this.menu.get(index);
}
}
\ No newline at end of file
File added
public class MenuSalades extends Menu {
public void add(Legume l){
LegumeSalades sal = (LegumeSalades) l;
this.menu.add(sal);
}
public void add(Herbe he){
HerbeSalades sal = (HerbeSalades) he;
this.menu.add(sal);
}
public void add(Huile hu){
HuileSalades sal = (HuileSalades) hu;
this.menu.add(sal);
}
public void addAll(Ingredient... ingredients){
for(Ingredient l: ingredients){
this.menu.add(l);
}
}
public Ingredient get(int index){
return this.menu.get(index);
}
}
\ No newline at end of file
File added
public class MenuVapeur extends Menu {
public void add(Legume l){
LegumeVapeur vap = (LegumeVapeur) l;
this.menu.add(vap);
}
public void add(Herbe he){
HerbeVapeur vap = (HerbeVapeur) he;
this.menu.add(vap);
}
public void add(Huile hu){
HuileVapeur vap = (HuileVapeur) hu;
this.menu.add(vap);
}
public void addAll(Ingredient... ingredients){
for(Ingredient l: ingredients){
this.menu.add(l);
}
}
public Ingredient get(int index){
return this.menu.get(index);
}
}
\ No newline at end of file
File added
public class Potage {
}
\ No newline at end of file
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment