Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The LemonadeStand methods are: init method - takes one parameter, a string for the name of the stand; initializes the name to that value, initializes

The LemonadeStand methods are:
init method - takes one parameter, a string for the name of the stand; initializes the name to that value, initializes current day to zero, initializes the menu to an empty dictionary, and initializes the sales record to an empty list
a get method for the name: get_name()
add_menu_item:
Takes as a parameter a MenuItem object and adds it to the menu dictionary
New items can be added to the menu on any day
enter_sales_for_today:
Takes as a parameter a dictionary where the keys are names of items sold and the corresponding values are how many of the item were sold (see the example at the end of the readme)
If an item in the menu doesn't appear in the dictionary, then there were no sales of that item on that day. You don't need to worry about this in this method, but it's important in the next method.
If the name of any item sold doesn't match the name of any MenuItem in the dictionary of MenuItem objects, this method should do nothing except raise an InvalidSalesItemError (you'll need to define this exception class)
Otherwise, it should create a new SalesForDay object using the current day and the dictionary that was passed in, add that object to the list of SalesForDay objects, and then increment the current day by 1
Any time this method is called (and the exception isn't raised), exactly one SalesForDay object should be created and added to the list
sales_of_menu_item_for_day:
Takes as parameters an integer representing a particular day and a string for the name of a menu item
Returns the number of that item sold on that day
This method uses the given day to find the corresponding SalesForDay object in the list and then calls its get_sales_dict() method to get the dictionary of sales for that day
Then looks for the item name in the dictionary, taking into account that if an item in the menu doesn't appear in the dictionary, then there were no sales of that item on that day
total_sales_for_menu_item:
Takes as a parameter a string for the name of a menu item and returns the total number of that item sold over the history of the stand
This method can make use of sales_of_menu_item_for_day
total_profit_for_menu_item:
Takes as a parameter a string for the name of a menu item and returns the total profit on that item over the history of the stand
The profit for any item sold is the selling price of the item minus the wholesale cost of the item
This method can make use of total_sales_for_menu_item
total_profit_for_stand:
Takes no parameters and returns the total profit on all items sold over the history of the stand
This method can make use of total_profit_for_menu_item

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

BPR always involves automation. Group of answer choices True False

Answered: 1 week ago

Question

Define HRM and its relation to organizational management

Answered: 1 week ago

Question

Explain the theoretical issues surrounding the HRM debate

Answered: 1 week ago