Question

In: Computer Science

The restaurant maintains the catalog for the list of food and beverage items that it provides....

The restaurant maintains the catalog for the list of food and beverage items that it provides. Apart from providing food facility at their own premises, the restaurant takes orders online through their site. Orders on the phone are also entertained. To deliver the orders, we have delivery boys. Each delivery boy is assigned to the specific area code. The delivery boy cannot deliver outside the area which is not assigned to the delivery boy (for every delivery boy there can be a single area assigned to that delivery boy). The customer record is maintained so that premium customer can be awarded discounts.

Need copy of code and a report if possible.

Code is Python.

Solutions

Expert Solution

'''we will define three classes

   1.restaurant
   2.delivery_boy
   3.customer
'''

'''
first we will work on coustomer
we will keep record of
1. customer name
2. customer pin code
3. customer past order
4. is customer premium or not
5. the method in the order function is to check whether the order is online or offline
mrthod:
   0 - offline
   1 - on phone
   3 - online
'''

class customer:

   def __init__(self, name, pin, is_premium = False):
       self.order = []
       self.ongoing_order = []
       self.name = name
       self.pin = pin
       self.is_premium = is_premium

   def place_order(self, dish, method, delivery_boy = None, pin = None, cost):
       self.ongoing_order.append((dish, method, delivery_boy, pin, cost))

   def complete_order(self):
       self.order.append(self.ongoing_order[0])
       self.ongoing_order = []

'''
now for delivery boy we just see its pin and currently free or not
'''
class delivery_boy:

   def __init__(self, name, pin, is_available = True):
       self.name = name
       self.pin = pin
       self.order = []
       self.ongoing_order = []
       self.is_available = is_available

   def accept_order(self, dish, customer, pin, method, cost):
       self.ongoing_order.append((dish, customer, pin, cost))
       self.is_available = False

   def complete_order(self):
       self.is_available = True
       self.order.append(self.ongoing_order[0])
       self.ongoing_order = []

'''
now define the resaurant class
'''
class restaurant:

   def __init__(name, discount = 0):
       self.name = name;
       self.dishes = []
       self.coustomer = []
       self.orders = []
       self.delivery_boy = []
       self.discount = discount
       self.ongoing_orders = []

   def add_dish(self, name, price):
       self.dishes((name,price))

   def add_customer(self, name, pin, is_premium = False):
       new_customer = customer(name, pin, is_premium = False);
       self.customer.append(new_customer)

   def add_delivey_boy(self, name, pin, is_available = True):
       new_delivery_boy = delivery_boy(name, pin, is_available = True)
       self.delivery_boy.append(new_delivery_boy)

   def place_order(dish, customer_name, pin = None, method):

       #first check if customer exist or not
       for customer in self.coustomer:
           if (customer.name == customer_name):
               break

       if (customer.name != customer_name):
           raise Exception('coustomer havent registered. Please sign up')

       if (len(customer.ongoing_order) > 0):
           raise Exception('the customer has already an ongoing order')

       if (pin == None):
           pin = customer.pin

       if (method != 0):
           for d in self.delivery_boy:
               if (d.pin == pin and d.is_available):
                   break

           if (d.pin != pin or not d.is_available):
               raise Exception('delivery boy not available')

           self.ongoing_order.append(customer, d, dish, pin, method)
           d.accept_order(dish, customer, pin, method, cost)
           customer.place_order(dish, method, d, pin, cost)

   def complete_order(self, customer):

       for i in range(0, len(self.ongoing_order)):
           if (self.ongoing_order[i][0].name = customer.name):
               break

       self.order.append(self.ongoing_order[i])
       self.ongoing_order[i][2].complete_order
       customer.complete_order
       del self.ongoing_order[i:i+1]


Related Solutions

Food. List at least 3 food items that make up a meal; list the grams of...
Food. List at least 3 food items that make up a meal; list the grams of carbohydrates, fats and protein in each food item, convert grams to calories for each component in these food items, calculate % calories from each component, the total calories from each food item and total calories from this meal. A table would help organize the information. Comment on this meal. List 4 dietary supplements that are commonly used and what is the presumed function of...
In your home, choose five food items and five non-food items Make a list of these ten items and classify each item as:
In your home, choose five food items and five non-food items Make a list of these ten items and classify each item as: Made of cells or not made of cells? If not made of cells, of what is it made? If made of cells, are the cells dead or alive (in your best judgement)
A fast-food restaurant promotes certain food items by giving a game piece with each item. Advertisements...
A fast-food restaurant promotes certain food items by giving a game piece with each item. Advertisements proclaim that “25% of the game pieces are Instant Winners!” To test this claim, a frequent diner collects 20 game pieces and gets only 3 instant winners. Identify the population, the parameter, the sample, and the statistic in this context. Suppose the advertisements are correct and p = 0.25. The dotplot below shows the distribution of the sample proportion of instant winners in 100...
List the benefits that organic food provides to people, the environment, and society.
List the benefits that organic food provides to people, the environment, and society.
1. A 345-room hotel’s food and beverage department recorded food revenue of $3,460,397.5 and beverage revenue...
1. A 345-room hotel’s food and beverage department recorded food revenue of $3,460,397.5 and beverage revenue of $1,483,027.5. The cost of sales was 27.3% of F & B revenue, and the departmental expenses were 43.2% of F & B revenue. What is the gross profit percentage for the hotel’s F&B department? 2. Year 1 Year 2 Gross Room Rate (GRR) $245.00 Direct Costs (35% of GRR) $85.75 Net Room Rate (NRR) $159.25 Expenses-(Fixed) (FE) $60.00 Net Profit (NP) $99.25 Profit...
Total sales $120,000 Food & Beverage $24,000 Total expenses $84,000 Cost of Food and Beverage based...
Total sales $120,000 Food & Beverage $24,000 Total expenses $84,000 Cost of Food and Beverage based on total sale (total sale * percentage = cost of food and beverage) What percentage of Cost of Food and Beverage is needed to increase the Battle of the Chefs event's net profit by 10%? (Hint: Create a formula to calculate the 10% increase, then use Goal Seek.)
4 Food and Beverage AB213-2: Determine required sanitary and safety procedures in food and beverage operations....
4 Food and Beverage AB213-2: Determine required sanitary and safety procedures in food and beverage operations. In a university dining hall and based on FDA, OSHA, and HACCP standards, address the concerns the new chef has when viewing current operations at the dining hall. Scenario: As the Chef enters the restaurant kitchen she sees the following situation: One preparation person with long hair is grabbing several heads of lettuce from the refrigerator and placing them on a cutting board immediately...
At a certain fast food restaurant, 77.5% of the customers order items from the value menu....
At a certain fast food restaurant, 77.5% of the customers order items from the value menu. If 14 customers are randomly selected, what is the probability that at least 9 customers ordered an item from the value menu? Use Excel to find the probability.
The Zagat Restaurant Survey provides food, decor, and service ratings for some of the top restaurants...
The Zagat Restaurant Survey provides food, decor, and service ratings for some of the top restaurants across the United States. For 21 restaurants located in a certain city, the average price of a dinner, including one drink and tip, was $48.60. You are leaving on a business trip to this city and will eat dinner at three of these restaurants. Your company will reimburse you for a maximum of $50 per dinner. Business associates familiar with these restaurants have told...
The Zagat Restaurant Survey provides food, decor, and service ratings for some of the top restaurants...
The Zagat Restaurant Survey provides food, decor, and service ratings for some of the top restaurants across the United States. For 18 restaurants located in a certain city, the average price of a dinner, including one drink and tip, was $48.60. You are leaving on a business trip to this city and will eat dinner at three of these restaurants. Your company will reimburse you for a maximum of $50 per dinner. Business associates familiar with these restaurants have told...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT