/// <summary> /// Waits on a table. /// </summary> /// <param name="cook">The cook to make the meal.</param> /// <param name="menu">The menu from which the patron will order.</param> /// <param name="patron">The patron to be served.</param> public void WaitTable(Cook cook, Menu menu, Patron patron) { // Create a new ticket for this patron. Ticket ticket = new Ticket(); // Define a variable to hold a menu item. MenuItem menuItem; // Get the patron's drink order. menuItem = patron.PlaceDrinkOrder(menu); // If an item was ordered... if (menuItem != null) { // Add the drink to the ticket. ticket.AddMenuItem(menuItem); // Add the price of the drink to the ticket's total amount due. ticket.TotalDue += menuItem.Price; } // Get the patron's meal order. menuItem = patron.PlaceMealOrder(menu); // If an item was ordered... if (menuItem != null) { // Add the meal to the ticket. ticket.AddMenuItem(menuItem); // Add the price of the meal to the ticket's total amount due. ticket.TotalDue += menuItem.Price; } // For each menu item in the ticket. foreach (MenuItem mi in ticket.MenuItems) { // Define a variable to hold a food item. FoodItem foodItem; // Have the cook make a food item, given the current menu item. foodItem = cook.MakeMeal(mi); // Add the food item to the ticket. ticket.AddFoodItem(foodItem); } // Give the patron the ticket (which includes the ordered food items.) patron.TakeTicketAndMeal(ticket); // Clear the waitress' ticket (giving sole ownership of it to the patron.) ticket = null; }
/// <summary> /// Tend to the regular. /// </summary> /// <param name="menuType">The type of menu to give to the regular.</param> public void TendToTheRegular(string menuType) { // Find a waitress for "The Regular". Waitress waitress = this.FindWaitress(this.TheRegular); // Find a menu. Menu menu = this.FindMenu(menuType); Cook owner = this.Owner; Patron theregular = this.TheRegular; // Wait on "The Regular's" table. waitress.WaitTable(this.Owner, menu, this.TheRegular); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="basketBreadstickCapacity">The number of breadsticks the basket can hold.</param> /// <param name="capacity">The capacity of the restaurant.</param> /// <param name="charityName">The name of the cook's charity.</param> /// <param name="cookName">The name of the restaurant's cook.</param> /// <param name="cookSalary">The salary of the restaurant's cook.</param> /// <param name="dinnerMenu">The restaurant's dinner menu.</param> /// <param name="lunchMenu">The restaurant's lunch menu.</param> /// <param name="name">The name of the restaurant.</param> /// <param name="ovenBreadstickBatchSize">The number of breadsticks that can be made in the oven at one time.</param> /// <param name="stoveSoupBatchSize">The amount of soup that can be made on the gas stove at one time.</param> /// <param name="vatCapacity">The amount of soup that the vat can hold.</param> public Restaurant( int basketBreadstickCapacity, int capacity, string charityName, string cookName, decimal cookSalary, Menu dinnerMenu, Menu lunchMenu, string name, int ovenBreadstickBatchSize, double stoveSoupBatchSize, double vatCapacity) { this.capacity = capacity; this.dinnerMenu = dinnerMenu; this.lunchMenu = lunchMenu; this.name = name; this.owner = new Cook(basketBreadstickCapacity, charityName, cookName, ovenBreadstickBatchSize, cookSalary, stoveSoupBatchSize, vatCapacity); this.waitresses = new List <Waitress>(); }