Correct my code please. Trying to get this to run, where each test below works class MenuItem:     def __init__(self, name, wholesale_cost, selling_price):         self._name = name         self._wholesale_cost = wholesale_cost         self._selling_price = selling_price     def get_name(self):         return self._name     def get_wholesale_cost(self):         return self._wholesale_cost     def get_selling_price(self):         return self._selling_price class SalesForDay:     def __init__(self, day, sales_dictionary):         self._day = day         self._sales_dict = sales_dictionary     def get_day(self):         return self._day     def get_sales_dict(self):         return self._sales_dict class LemonadeStand:     def __init__(self, stand_names):         self._stand_names = stand_names         self._current_day = 0         self._menu = {}         self._sales_record = []     def get_stand_names(self):         return self._stand_names     def add_menu_item(self, menuitems):         self.menuitems[menuitems.get_name()] = menuitems     def enter_sales_for_today(self, sales_dictionary):         items_sold = sales_dictionary.keys()         for item in items_sold:             if item not in self._items_dictionary.keys():                 raise InvalidSalesItemError                 SalesForDay = SalesForDay(current_day, sales_dict)         self._sale_record.append(SalesForDay)     def sales_of_menu_item_for_day(self, day, name_menu_item):         for sell in self._sales_for_day_list:             if day == sell.get_day():                 return objects.get_sales_dictionary()[name_menu_item]     def total_sales_for_menu_item(self, menu_name):         total_sales = 0         for today_sales in self.sales_record:             total_sales += today_sales.get_sales_dict()[menu_name]             return total_sales     def total_profit_for_menu_item(self, menu_items_name):         item_sales_history = self.total_sales_for_menu_item(menu_items_name)         menu_item = self._menu.get(menu_items_name)         items_total_sales_profit = item_sales_history * menu_item.get_selling_price() - item_sales_history * menu_item.get_wholesale_cost()         return items_total_sales_profit     def total_profit_for_stand(self):         total_profit = 0         for items in self._items_dictionary.keys():             total_profit += self.total_profit_menu_item(menu_name)             return total stand = LemonadeStand('Lemons R Us')  # Create a new LemonadeStand callled 'Lemons R Us' item1 = MenuItem('lemonade', 0.5, 1.5)  # Create lemonade as a menu item (wholesale cost 50 cents, selling price $1.50) stand.add_menu_item(item1)  # Add lemonade to the menu for 'Lemons R Us' item2 = MenuItem(('nori'), 0.6, 0.8)  # Create nori as a menu item (wholesale cost 60 cents, selling price 80 cents) stand.add_menu_item(item2)  # Add nori to the menu for 'Lemons R Us' item3 = MenuItem('cookie', 0.2, 1  # Create cookie as a menu item (wholesale cost 20 cents, selling price $1.00) stand.add_menu_item(item3)  # Add cookie to the menu for 'Lemons R Us'         # This dictionary records that on day zero, 5 lemonades were sold, 2 cookies were sold, and no nori was sold day_0_sales = {             'lemonade': 5,             'cookie': 2              } stand.enter_sales_for_today(day_0_sales)  # Record the sales for day zero print(f"lemonade profit = {stand.total_profit_for_menu_item('lemonade')}"  # print the total profit for lemonade so far

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Correct my code please. Trying to get this to run, where each test below works

class MenuItem:
    def __init__(self, name, wholesale_cost, selling_price):
        self._name = name
        self._wholesale_cost = wholesale_cost
        self._selling_price = selling_price

    def get_name(self):
        return self._name

    def get_wholesale_cost(self):
        return self._wholesale_cost

    def get_selling_price(self):
        return self._selling_price


class SalesForDay:
    def __init__(self, day, sales_dictionary):
        self._day = day
        self._sales_dict = sales_dictionary

    def get_day(self):
        return self._day

    def get_sales_dict(self):
        return self._sales_dict


class LemonadeStand:
    def __init__(self, stand_names):
        self._stand_names = stand_names
        self._current_day = 0
        self._menu = {}
        self._sales_record = []

    def get_stand_names(self):
        return self._stand_names

    def add_menu_item(self, menuitems):
        self.menuitems[menuitems.get_name()] = menuitems

    def enter_sales_for_today(self, sales_dictionary):
        items_sold = sales_dictionary.keys()
        for item in items_sold:
            if item not in self._items_dictionary.keys():
                raise InvalidSalesItemError
                SalesForDay = SalesForDay(current_day, sales_dict)
        self._sale_record.append(SalesForDay)

    def sales_of_menu_item_for_day(self, day, name_menu_item):
        for sell in self._sales_for_day_list:
            if day == sell.get_day():
                return objects.get_sales_dictionary()[name_menu_item]

    def total_sales_for_menu_item(self, menu_name):
        total_sales = 0
        for today_sales in self.sales_record:
            total_sales += today_sales.get_sales_dict()[menu_name]
            return total_sales

    def total_profit_for_menu_item(self, menu_items_name):
        item_sales_history = self.total_sales_for_menu_item(menu_items_name)
        menu_item = self._menu.get(menu_items_name)
        items_total_sales_profit = item_sales_history * menu_item.get_selling_price() - item_sales_history * menu_item.get_wholesale_cost()
        return items_total_sales_profit

    def total_profit_for_stand(self):
        total_profit = 0
        for items in self._items_dictionary.keys():
            total_profit += self.total_profit_menu_item(menu_name)
            return total

stand = LemonadeStand('Lemons R Us')  # Create a new LemonadeStand callled 'Lemons R Us'
item1 = MenuItem('lemonade', 0.5, 1.5)  # Create lemonade as a menu item (wholesale cost 50 cents, selling price $1.50)
stand.add_menu_item(item1)  # Add lemonade to the menu for 'Lemons R Us'
item2 = MenuItem(('nori'), 0.6, 0.8)  # Create nori as a menu item (wholesale cost 60 cents, selling price 80 cents)
stand.add_menu_item(item2)  # Add nori to the menu for 'Lemons R Us'
item3 = MenuItem('cookie', 0.2, 1  # Create cookie as a menu item (wholesale cost 20 cents, selling price $1.00)
stand.add_menu_item(item3)  # Add cookie to the menu for 'Lemons R Us'

        # This dictionary records that on day zero, 5 lemonades were sold, 2 cookies were sold, and no nori was sold
day_0_sales = {
            'lemonade': 5,
            'cookie': 2
             }

stand.enter_sales_for_today(day_0_sales)  # Record the sales for day zero
print(f"lemonade profit = {stand.total_profit_for_menu_item('lemonade')}"  # print the total profit for lemonade so far

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY