Commit 160746d6 authored by Alexis LOBBEDEZ's avatar Alexis LOBBEDEZ

Mon premier commit

parent 64902b11
Pipeline #2235 failed with stages
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}
File added
package Fabrique;
import Pizza.Pizza;
import Pizza.Nord.PizzaFrite;
import Pizza.Nord.PizzaFromage;
public class FabriquePizzaNord implements SimpleFabriqueDePizza {
@Override
public Pizza creerPizza(String type) {
switch (type) {
case "frite": {
return new PizzaFrite();
}
case "fromage": {
return new PizzaFromage();
}
default:
return null;
}
}
}
\ No newline at end of file
package Fabrique;
import Pizza.Pizza;
import Pizza.Paris.PizzaGrecque;
public class FabriquePizzaParis implements SimpleFabriqueDePizza {
@Override
public Pizza creerPizza(String choix) {
switch (choix) {
case "Grecque": {
return new PizzaGrecque();
}
default:
return null;
}
}
}
\ No newline at end of file
package Fabrique;
import Pizza.Pizza;
public interface SimpleFabriqueDePizza {
public Pizza creerPizza(String type);
}
\ No newline at end of file
//import Pizza.Pizza;
import Pizzeria.PizzeriaNord;
import Pizzeria.PizzeriaParis;
public class Main {
public static void main(String[] args) {
PizzeriaNord pizzeriaNord = new PizzeriaNord();
pizzeriaNord.commanderPizza("frite");
System.out.println();
System.out.println();
PizzeriaParis pizzeriaParis = new PizzeriaParis();
pizzeriaParis.commanderPizza("Grecque");
}
}
\ No newline at end of file
package Pizza.Nord;
import Pizza.Pizza;
public class PizzaFrite implements Pizza {
@Override
public void emballer() {
System.out.println("J'emballer ma pizza frite");
}
@Override
public void couper() {
System.out.println("Je coupe mes pommes de terre en frites");
}
@Override
public void cuire() {
System.out.println("Je cuis mes frites");
}
@Override
public void preparer() {
System.out.println("Je prépare ma pizza frite");
}
}
\ No newline at end of file
package Pizza.Nord;
import Pizza.Pizza;
public class PizzaFromage implements Pizza {
@Override
public void emballer() {
System.out.println("J'emballer ma pizza au fromage");
}
@Override
public void couper() {
System.out.println("Je coupe mes morceaux de fromage");
}
@Override
public void cuire() {
System.out.println("Je cuis mes ingrédients");
}
@Override
public void preparer() {
System.out.println("Je prépare ma pizza au fromage");
}
}
\ No newline at end of file
package Pizza.Paris;
import Pizza.Pizza;
public class PizzaGrecque implements Pizza {
@Override
public void emballer() {
System.out.println("J'emballer ma pizza Grecque");
}
@Override
public void couper() {
System.out.println("Je hache ma viande et je coupe mes légumes");
}
@Override
public void cuire() {
System.out.println("Je cuis mes ingrédients");
}
@Override
public void preparer() {
System.out.println("Je prépare ma pizza Grecque, régale du chef !");
}
}
\ No newline at end of file
package Pizza;
public interface Pizza {
void emballer();
void couper();
void cuire();
void preparer();
}
\ No newline at end of file
package Pizzeria;
import Pizza.Pizza;
public interface Pizzeria {
public Pizza commanderPizza(String type);
}
\ No newline at end of file
package Pizzeria;
import Fabrique.FabriquePizzaNord;
import Pizza.Pizza;
public class PizzeriaNord implements Pizzeria{
public FabriquePizzaNord fabrique;
public PizzeriaNord() {
this.fabrique = new FabriquePizzaNord();
}
@Override
public Pizza commanderPizza(String type) {
Pizza pizza;
pizza = fabrique.creerPizza(type);
pizza.preparer();
pizza.cuire();
pizza.couper();
pizza.emballer();
return pizza;
}
}
\ No newline at end of file
package Pizzeria;
import Fabrique.FabriquePizzaParis;
import Pizza.Pizza;
public class PizzeriaParis implements Pizzeria{
public FabriquePizzaParis fabrique;
public PizzeriaParis() {
this.fabrique = new FabriquePizzaParis();
}
@Override
public Pizza commanderPizza(String type) {
Pizza pizza;
pizza = fabrique.creerPizza(type);
pizza.preparer();
pizza.cuire();
pizza.couper();
pizza.emballer();
return pizza;
}
}
\ No newline at end of file
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