Here's the class I HAVE to use:
public class AutomatedKitchen
{
public final int DEFAULT_NUMBER_SERVINGS = 4;
public final int DEFAULT_COOK_TEMP = 350;
public final int DEFAULT_COOK_TIME = 30;
public final int MAX_INGREDIENTS = 10;
private int numberServings;
private String[] ingredientList;
private int cookTemp;
private int cookTime;
private boolean healthyFood;
private int nextArrayIndex = 0;
private String cookedMeal;
private boolean mealReady;
public AutomatedKitchen()
{
this.numberServings = 4;
this.cookTemp = 350;
this.cookTime = 30;
this.ingredientList = new String[11];
this.ingredientList[0] = "water";
this.ingredientList[10] = "";
}
public void setNumberServings(int paramInt)
{
this.numberServings = paramInt;
}
public void setIngredient(String paramString)
{
if (this.nextArrayIndex < 10) {
this.ingredientList[this.nextArrayIndex] = paramString;
this.nextArrayIndex += 1;
}
}
public int getNumberIngredients()
{
return this.ingredientList.length;
}
public void setCookTemp(int paramInt)
{
this.cookTemp = paramInt;
}
public int getCookTemp()
{
return this.cookTemp;
}
public void setCookTime(int paramInt)
{
this.cookTime = paramInt;
}
public int getCookTime()
{
return this.cookTime;
}
public void setHealthyFood(boolean paramBoolean)
{
this.healthyFood = paramBoolean;
}
public boolean getHealthyFood()
{
return this.healthyFood;
}
public void cookMeal()
{
this.mealReady = true;
}
public boolean readyToServe()
{
return this.mealReady;
}
public String serveMeal()
{
if (!readyToServe()) {
return "This meal is not cooked yet!";
}
if (this.nextArrayIndex == 0) this.ingredientList[10] = this.ingredientList[0];
else {
for (int i = 0; i < this.nextArrayIndex; i++) {
if (i == this.nextArrayIndex - 1) this.ingredientList[10] = (this.ingredientList[10] + "and " + this.ingredientList[i]); else {
this.ingredientList[10] = (this.ingredientList[10] + this.ingredientList[i] + ", ");
}
}
}
double d = Math.random() * 10.0D;
String str1;
if (d < 3.0D) str1 = "pretty good";
else if (d < 6.0D) str1 = "terrible"; else
str1 = "five star delicous";
String str2;
if (getHealthyFood()) str2 = "healthy"; else str2 = "unhealthy";
this.mealReady = false;
return "Serving a meal for " + this.numberServings + ". This meal is " + str2 + ". We cooked a blend of " + this.ingredientList[10] + " for " + getCookTime() + " minutes at " + getCookTemp() + " degrees. It's " + str1 + ".";
}
}
And here's the main class that I've written thus far.....to include lots of errors:
public class Restaurant {
public static void main (String[] args) {
AutomatedKitchen Table1 = new AutomatedKitchen();
Table1.setNumberServings(4);
Table1.setIngredient("water")
Table1.setCookTemp(350);
Table1.setCookTime(30);
Table1.getNumberIngredients();
Table1.getCookTemp();
Table1.getCookTime();
System.out.println(Table1);
AutomatedKitchen Table2 = new AutomatedKitchen();
Table2.setNumberServings(10);
Table2.setIngredient("water, french fries, pizza, buffalo wings");
Table2.setCookTemp(400);
Table2.setCookTime(10);
System.out.println(Table2);
AutomatedKitchen Table3 = new AutomatedKitchen();
Table3.setNumberServings(1);
Table2.setIngredient(water, minestrone soup, chicken cordon bleu");
Table3.setCookTemp(375);
Table3.setCookTime(30);
System.out.println(Table3);
} // end of main() method
}
My assignment is to:
Write a driver class that simulates a restaurant using AutomaticKitchen.class. You have three tables, one with four people, one with 12 people, and one with 1 person. Everyone at any given table eats the same thing.
Use the AutomatedKitchen in your driver to make and serve a different meal to each table. You can be creative with your ingredients. You might not need to use all the available API methods.

New Topic/Question
Reply




MultiQuote










|