Question
Modular Ham Sandwich Maker Machine Program follow these steps. 1- Code Skeleton: The code skeleton is available through the Code below. The code for assignment
Modular Ham Sandwich Maker Machine Program
follow these steps.
1- Code Skeleton: The code skeleton is available through the Code below. The code for assignment 1 can also be implemented in another way, and you can choose your own way of implementation. 2- Import all modules into main.py Three modules (data, sandwich_maker, cashier) should be imported at the top of main.py. import
The Code:
class Cashier: def __init__(self): pass
def process_coins(self): """Returns the total calculated from coins inserted. Hint: include input() function here, e.g. input("how many quarters?: ")""" ###
def transaction_result(self, coins, cost): """Return True when the payment is accepted, or False if money is insufficient. Hint: use the output of process_coins() function for cost input""" ##
recipes = { "small": { "ingredients": { "bread": 2, ## slice "ham": 4, ## slice "cheese": 4, ## ounces }, "cost": 1.75, }, "medium": { "ingredients": { "bread": 4, ## slice "ham": 6, ## slice "cheese": 8, ## ounces }, "cost": 3.25, }, "large": { "ingredients": { "bread": 6, ## slice "ham": 8, ## slice "cheese": 12, ## ounces }, "cost": 5.5, } }
resources = { "bread": 12, ## slice "ham": 18, ## slice "cheese": 24, ## ounces }
import data from sandwich_maker import SandwichMaker from cashier import Cashier
# Make an instance of other classes here resources = data.resources recipes = data.recipes sandwich_maker_instance = ##### cashier_instance = ######
def main(): ### write the rest of the codes ###
if __name__=="__main__": main()
class SandwichMaker: def __init__(self, resources): self.machine_resources = resources
def check_resources(self, ingredients): """Returns True when order can be made, False if ingredients are insufficient.""" #####
def make_sandwich(self, sandwich_size, order_ingredients): ########
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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