Skip to content
Snippets Groups Projects
Commit cc401a89 authored by Nicolas Fley's avatar Nicolas Fley
Browse files

work merged

parent 15f00073
Branches
No related tags found
No related merge requests found
...@@ -3,11 +3,13 @@ package Cli; ...@@ -3,11 +3,13 @@ package Cli;
import java.util.Scanner; import java.util.Scanner;
public class Confirm { public class Confirm {
static Scanner reader = new Scanner(System.in);
public static boolean text(String str){ public static boolean text(String str){
Scanner reader = new Scanner(System.in);
System.out.println(str); System.out.println(str);
System.out.println("(Y)es/(N)o : "); System.out.println("(Y)es/(N)o : ");
String answer = reader.nextLine(); String answer = reader.nextLine();
reader.close();
if(answer=="y" || answer == "Y" || answer == "o" || answer == "O") if(answer=="y" || answer == "Y" || answer == "o" || answer == "O")
return true; return true;
return false; return false;
......
package DeliveryStrategy;
import java.util.ArrayList;
import User.Courier;
public class FairOccupationDelivery implements StrategyDeliveryPolicy {
@Override
public void chooseCourier(ArrayList<Courier> listOfCourier) {
// TODO Auto-generated method stub
}
}
package DeliveryStrategy;
import java.util.ArrayList;
import User.Courier;
public class FastestDelivery implements StrategyDeliveryPolicy{
@Override
public void chooseCourier(ArrayList<Courier> listOfCourier) {
}
}
package DeliveryStrategy;
import java.util.ArrayList;
import User.Courier;
public interface StrategyDeliveryPolicy {
public abstract void chooseCourier(ArrayList<Courier> listOfCourier);
}
package Offers;
import Item.Meal;
public class MealOfTheWeek implements ObservableOffer {
private boolean state;
private Meal meal;
public MealOfTheWeek(boolean state, Meal meal) {
super();
this.state = state;
this.meal = meal;
}
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
public Meal getMeal() {
return meal;
}
public void setMeal(Meal meal) {
this.meal = meal;
}
@Override
public void attachObserver() {
// TODO Auto-generated method stub
}
@Override
public void detachObserver() {
// TODO Auto-generated method stub
}
@Override
public void notifyall() {
// TODO Auto-generated method stub
}
}
package Offers;
public interface ObservableOffer {
public abstract void attachObserver();
public abstract void detachObserver();
public abstract void notifyall();
}
package Offers;
public interface Observer {
public abstract void update();
}
package User; package User;
import java.util.Scanner;
import Cli.Confirm;
import Cards.BasicFidelityCard; import Cards.BasicFidelityCard;
import Cards.FidelityCard; import Cards.FidelityCard;
import Cards.LotteryFidelityCard; import Cards.LotteryFidelityCard;
...@@ -10,8 +13,13 @@ import Others.Adress; ...@@ -10,8 +13,13 @@ import Others.Adress;
import Others.Historique; import Others.Historique;
import Others.IDCard; import Others.IDCard;
import Order.Order; import Order.Order;
import Cli.Input;
import Item.FactoryDish;
import Item.Meal;
import Item.MealFactory;
import Offers.Observer;
public class Customer extends HumanUser implements VisiterCard { public class Customer extends HumanUser implements VisiterCard,Observer {
private boolean spamAgree; private boolean spamAgree;
...@@ -38,7 +46,72 @@ public class Customer extends HumanUser implements VisiterCard { ...@@ -38,7 +46,72 @@ public class Customer extends HumanUser implements VisiterCard {
return "Customer [spamAgree=" + spamAgree + ", historique=" + historique + ", card=" + card + "]"; return "Customer [spamAgree=" + spamAgree + ", historique=" + historique + ", card=" + card + "]";
} }
public void placeOrder(Order order, Restaurant restaurant){ public void placeOrder(Restaurant restaurant){
Order order = new Order();
System.out.println(restaurant.toString());
do {
if (Confirm.text("Do you want a Meal?")){
System.out.println("listdesMeal"); // faire
String choice = Cli.Input.string("Which meal do you want?");
boolean isIn = false;
for(Meal meal : restaurant.listOfMeal){
if(meal.toString() == choice){
isIn = true;
}
}
if (isIn == false){
System.out.println("This meal isn't propose by this restaurant");
}
else {
if(choice == "FullMeal"){
System.out.println("listedesDish"); // faire
String entry1 = Cli.Input.string("Which entry do you want in your meal?");
String main1 = Cli.Input.string("Which main do you want in your meal?");
String dessert1 = Cli.Input.string("Which dessert do you want in your meal?");
MealFactory factory1 = new MealFactory();
//Meal newmeal = factory1.createMeal("fullmeal", _name, _typeOfFood)
}
if (choice == "HalfMeal"){
System.out.println("listedesDish"); // faire
String typeOfFormule = Cli.Input.string("Which formula do you want? Entry/Main(EM) or Main/Dessert(MD)");
if(typeOfFormule == "EM"){
String entry2 = Cli.Input.string("Which entry do you want in your meal?");
String main2 = Cli.Input.string("Which main do you want in your meal?");
MealFactory factory2 = new MealFactory();
//Meal newmeal = factory2.createMeal("halfmeal"
}
else if(typeOfFormule == "MD"){
String main3 = Cli.Input.string("Which main do you want in your meal?");
String dessert3 = Cli.Input.string("Which dessert do you want in your meal?");
MealFactory factory3 = new MealFactory();
//Meal newmeal = factory3.createMeal("halfmeal"
}
else{
System.out.println("This type of Meal is not available");
}
}
}
}
else if (Confirm.text("Do you want a dish?")){
System.out.println("listOfDish");
String dish = Cli.Input.string("Which dish do you want ?");
FactoryDish factory4 = new FactoryDish();
}
} while (Confirm.text("Do you want something else ?"));
System.out.println("Do you want a Meal? (y)es or (n)o");
Scanner sc = new Scanner(System.in);
String choice = sc.nextLine();
if (Confirm.text("Do you want a Meal?")){
}
} }
...@@ -113,6 +186,13 @@ public class Customer extends HumanUser implements VisiterCard { ...@@ -113,6 +186,13 @@ public class Customer extends HumanUser implements VisiterCard {
} }
@Override
public void update() {
}
......
package User; package User;
import java.util.ArrayList;
import Item.Dish;
import Item.Meal;
import Others.Adress; import Others.Adress;
public class Restaurant extends MoralUser { public class Restaurant extends MoralUser {
//ArrayList<Meal> listOfMeal;
ArrayList<Meal> listOfMeal;
ArrayList<Dish> listOfDish;
/** CONSTRUCTOR **/
public Restaurant(long phoneNumber, String name, String username, String mail, String password, public Restaurant(long phoneNumber, String name, String username, String mail, String password,
Adress adress, boolean activated) { Adress adress, boolean activated) {
super(phoneNumber, name, username, mail, password, adress, activated); super(phoneNumber, name, username, mail, password, adress, activated);
//this.listOfMeal = listOfMeal this.listOfMeal = new ArrayList<Meal>();
this.listOfDish = new ArrayList<Dish>();
}
/** SETTERS**/
public void addMeal(Meal m){
boolean isalready = false;
for (Meal meal : this.listOfMeal) {
if(meal.equals(m)){
System.out.println("You already have this meal in our menu");
isalready = true;
}
}
if(isalready == false){
this.listOfMeal.add(m);
}
} }
public void addMeal(){
@Override
public String toString() {
return "Restaurant [listOfMeal=" + listOfMeal + ", listOfDish=" + listOfDish + "]";
} }
public void removeItem(){
public ArrayList<Meal> getListOfMeal() {
return listOfMeal;
}
public ArrayList<Dish> getListOfDish() {
return listOfDish;
}
public void addDish(Dish d){
boolean isalready = false;
for (Dish dish : this.listOfDish) {
if(dish.equals(d)){
System.out.println("You already have this dish in our menu");
isalready = true;
}
}
if(isalready == false){
this.listOfDish.add(d);
}
}
public void removeMeal(Meal m){
this.listOfMeal.remove(m);
}
public void removeDish(Dish d){
this.listOfDish.remove(d);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment