Last active
November 18, 2021 12:24
-
-
Save axel-andrade/4feadb6dfd0e3cf46cf4f01d24be1133 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum PreparationModeType = { | |
COOKED: "cooked", | |
ROAST: "roast" | |
}; | |
enum StatusPlate = { | |
DELIVERED: "delivered", | |
PREPARATION: "preparation", | |
WAITING: "waiting" | |
} | |
class Plate { | |
private ingredients: string[]; | |
private name: string; | |
private preparationModeType: PreparationModeType; | |
private price: number; | |
private status: StatusPlate; | |
construtor(ingredients: string[], name: string, preparationModeType: PreparationModeType, price: number){ | |
this.ingredients = ingredients; | |
this.name = name; | |
this.preparationModeType = preparationModeType; | |
this.price = price; | |
this.status = StatusPlate.WAITING; | |
} | |
public cook(): void { | |
this.status = StatusPlate.PREPARATION | |
// method implementation | |
} | |
public roast(): void { | |
this.status = StatusPlate.PREPARATION | |
// method implementation | |
} | |
public preparePlate() { | |
// Need to add a plate status check here | |
// Check the type of preparation mode and run the preparation method | |
switch(preparationModeType){ | |
case PreparationModeType.COOKED: | |
cook(); | |
break; | |
case PreparationModeType.ROAST: | |
roast(); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment