Question
Solve this in python. **[70 pts]** You will be writing code for recording the menuitems and daily sales of a lemonade stand. It will have
Solve this in python.
**[70 pts]** You will be writing code for recording the menuitems and daily sales of a lemonade stand. It will have theseclasses: MenuItem, SalesForDay, and LemonadeStand. All data membersof each class should be marked as **private** (a leading underscorein the name). Since they're private, if you need to access themfrom outside the class, you should do so via get or set methods.Here are the method descriptions for the three classes:**MenuItem:**
A MenuItem object represents a menu item to be offered for saleat the lemonade stand. * init method - takes as parameters threevalues with which to initialize the MenuItem: its name, itswholesale cost, and its selling price * get methods for each of thedata members: get_name(), get_wholesale_cost(), andget_selling_price() **SalesForDay:**
A SalesForDay object represents the sales for a particular day.* init method - takes as parameters two values with which toinitialize the SalesForDay: the day (an integer for the number ofdays the stand has been open so far), and a dictionary whose keysare the names of the items sold, and whose values are the numbersof those items sold that day * get methods for each of the datamembers: get_day() and get_sales_dict() **LemonadeStand:****Remember that the LemonadeStand class must not directly accessthe private data members of MenuItem and SalesForDay objects, butinstead must call the appropriate get methods** A LemonadeStandobject represents a lemonade stand, which has four data members: *a string for the name of the stand * an integer representing thecurrent day * a dictionary of MenuItem objects, where the keys arethe names of the items and the values are the correspondingMenuItem objects * a list of SalesForDay objects The Lemonade Standmetho0ds are: * init method - takes as a p0arameter the name of thestand; initializes the name to that value, initializes current dayto zero, initializes the menu to an empty dictionary, andinitializes the sales record to an empty list (**remember to notuse any mutable default arguments**) * a get method for the name:get_name() * add_menu_item - takes as a parameter a MenuItem objectand adds it to the menu dictionary * enter_sales_for_today - takesas a parameter a dictionary where the keys are names of items soldand the corresponding values are how many of the item were sold. Ifthe name of any item sold doesn't match the name of any MenuItem inthe menu, it raises an **InvalidSalesItemError** (you'll need todefine this exception class). Otherwise, it creates a newSalesForDay object, using the current day and the dictionary thatwas passed in, and then increments the current day by 1 *get_sales_dict_for_day - takes as a parameter an integerrepresenting a particular day, and returns the dictionary of salesfor that day (**not** a SalesForDay object) *total_sales_for_menu_item - takes as a parameter the name of a menuitem and returns the total number of that item sold over thehistory of the stand * total_profit_for_menu_item - takes as aparameter the name of a menu item and returns the total profit onthat item over the history of the stand * total_profit_for_stand -takes no parameters and returns the total profit on all items soldover the history of the stand **[10 pts]** **You must include amain function** that runs if the file is run as a script, but notif the file is imported. The main function should try callingenter_sales_for_today() with a dictionary that contains an itemname not in the menu. If an InvalidSalesItem is raised, it shouldbe caught with a try/except that prints an explanatory message forthe user (otherwise the function should proceed normally). **[20pts]** In addition to your file containing the code for the aboveclasses, **you must also submit a file that contains unit tests foryour classes. It must have at least five unit tests and use atleast two different assert functions. This part (like the rest)must be your own work. **Gradescope will not test your mainfunction or unit tests - the TAs will take care of that.** Here's avery simple example of how your classes could be used: ``` stand =LemonadeStand('Lemons R Us') item1 = MenuItem('lemonade', .5, 1.5)stand.add_menu_item(item1) item2 = MenuItem('cookie', .2, 1stand.add_menu_item(item2) day0 = { 'lemonade' : 5, 'cookie' : 2 }stand.enter_sales_for_today(day0) print(f"lemonade profit ={stand.total_profit_for_menu_item('lemonade')}") ``` Your filesmust be named: **LemonadeStand.py** and**LemonadeStandTester.py**
Step by Step Solution
3.42 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
ANSWER Python code to copy Storepy import re class Product def initselfidcodetitledescription priceq...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started