Microsoft Word - ITP115_FinalProject.docx ITP 115 – Programming in Python XXXXXXXXXXPage 1 of 13 FinalProject–RestaurantSimulation Goals • Complete a project that demonstrates problem solving...

1 answer below »
Please follow format and guidelines according to the attached pdf which contains assignment. Thanks!


Microsoft Word - ITP115_FinalProject.docx ITP 115 – Programming in Python 2021-04-27 Page 1 of 13 FinalProject–RestaurantSimulation Goals • Complete a project that demonstrates problem solving skills and logical thinking. • Demonstrate knowledge of Python programming concepts learned throughout the semester. You are not allowed to use Python concepts that were not taught this semester in this course. Overview • You will be writing a program that simulates a restaurant using object-oriented programming. You will be creating objects that represent a waiter, diners, a menu, and menu items, as well as reading in data from a CSV file. • It is recommended that you implement the code in the order listed below. After completing each part, it is also recommended that you test the functionality of your existing code before proceeding to the next part. • To best understand the structure and flow of the simulation, please read all the directions through before beginning any code. Requirements • In PyCharm, create a new project named project_last_first where last is your last/family name and first is your preferred first name. • This project will be a folder containing the required class files you write, the given helper file, the given txt file, and the given CSV file. • Use proper coding styles and comments. • Name newly created Python files as directed below. • Project should perform error-checking (on all inputs). • Use the Python concepts that we have covered during this semester. • You may NOT import the CSV or other modules. ITP 115 – Programming in Python 2021-04-27 Page 2 of 13 FilesProvided Download the following Python files and put them in your newly created project. RestaurantHelper.py • We have provided a helper file for you called RestaurantHelper.py which includes helper methods to allow diners to randomly show up to the restaurant. • You will not need to interact directly with this file, however it is important that you add it to your directory with the other project files. Run.py • We have also provided a main function for you in a file called Run.py which starts the simulation. This is the only file that you will need to run and it should also be placed in the same directory as your project files. • You will need to update the restaurant name variable (currently an empty string) to your own restaurant name. • Currently, a few lines are commented out because the classes detailed below are not yet implemented. Once the classes are fully implemented you should be able to uncomment those lines (the "TODO" comments will detail where you should be uncommenting) to run the full simulation. Right now, the program will only print out different times, pausing for 1 second between intervals. names.txt • List of all names for diners menu.csv • A CSV (comma-separated values) file with menu items • Each line in the file represents a menu item: o Name,Category,Price,Description • CSV file example: Sparkling Water,Drink,1.5,Refreshing bottle of sparkling mineral water. BBQ Glazed Wings,Appetizer,7.5,Chicken wings tossed in guava-BBQ sauce. Fresh Salmon,Entree,17.0,A miso-garlic marinated fillet seared. Rustic Apple Pie,Dessert,7.0,Cinnamon apples on our flaky crust. • There is not a header row in the CSV file. ITP 115 – Programming in Python 2021-04-27 Page 3 of 13 Part1–CreatingtheRestaurant’sMenu To represent a menu, you will be creating two separate classes: MenuItem and Menu. MenuItem Class • Start by defining the MenuItem class in a file titled MenuItem.py. • This class will represent a single item that a diner can order from the restaurant’s menu. • The class will have the following instance attributes: o self.name: a string containing the name of the item o self.category: a string containing the category of the item o self.price: a float containing the price of the item o self.desc: a string containing a description of the item • Define the following methods: o __init__ § Parameters (4): name (string), category (string), price (float), and description (string) of the item § Return value: None § Assign the inputs to the 4 instance attributes listed above. § The parameter of price should be a float, not a string. o Define get methods for all the instance attributes. There is no need to define set methods for the instance attributes. o __str__ § Parameters (0): None § Return value: a string § Construct a message containing all 4 attributes, formatted in a readable manner such as: Name (Category): $PriceDescription § For example: Fresh Spring Rolls (Appetizer): $3.99 4 vegetarian rolls wrapped in rice paper either fresh or fried § To print two places after the decimal point, you can use the str.format() method which returns a string. Example: "{:.2f}".format(self.price) ITP 115 – Programming in Python 2021-04-27 Page 4 of 13 Menu Class • Next, define the Menu class in a file titled Menu.py. This class will make use of MenuItem objects, so be sure to include the proper import statement. • This class represents the restaurant’s menu which contains four different categories of menu items diners can order from. • The class will have a following class (or static) variable: o CATEGORIES: a list containing 4 strings, representing the 4 possible categories of menu items: "Drink", "Appetizer", "Entree", "Dessert". • The class will have the following instance attributes: o self.drinks: a list containing MenuItem objects that are the drink menu items from the menu o self.appetizers: a list containing MenuItem objects that are the appetizer menu items from the menu o self.entrees: a list containing MenuItem objects that are the entree menu items from the menu o self.desserts: a list containing MenuItem objects that are the dessert menu items from the menu o Extra credit § Instead of four lists, you can use a single dictionary self.items: a dictionary containing all the menu items from the menu. The keys are strings representing the categories in the Menu class, and each value is a list of MenuItem objects depending on the key. § Use the CATEGORIES class variable for the keys whenever possible. • Define the following methods: o __init__ § Parameter (1): the name of the CSV file (string) that contains the menu § Return value: None § Initialize each instance attribute to an empty list. § Open and read the CSV file. § Create a MenuItem object from each line in the file. Use the category to add the new object to one of the instance attributes. Note that each line in the file contains the 4 pieces of information needed to create a MenuItem object. § Close the file object. o getMenuItem § Parameters (2): a category (string) and an index (integer) which is the position of a certain menu item § Return value: a MenuItem object from the appropriate instance attribute using the index parameter ITP 115 – Programming in Python 2021-04-27 Page 5 of 13 § For error checking, make sure that the category parameter is one of the CATEGORIES. § For error checking, make sure that the index parameter is in the range of the appropriate list. § Return the correct MenuItem using its category and index position. § If the category and/or index were not valid, then do not return anything. o printMenuItems § Parameter (1): a category (string) § Return value: None § For error checking, make sure that the category parameter is one of the CATEGORIES. If it is not, then don’t print anything. § Print a header with the category of menu items, followed by a numbered list of all the menu items of that category. Start the numbering at 0. § Example: -----DRINKS----- 0) Soda (Drink): $1.5 Choose from Sprite or Pepsi 1) Thai Iced Tea (Drink): $3.0 Glass of Thai iced tea 2) Coffee (Drink): $1.5 Black coffee either hot or cold o getNumMenuItems § Parameter (1): a category (string) § Return value: an integer which is the number of MenuItems in the appropriate list based on the category parameter § For error checking, make sure that the category parameter is one of the CATEGORIES. If it is not, then return 0. o You do not need to define any get and set methods for the instance attributes of this class. o You are welcome to create the __str__ method that returns a string containing the full menu. This can be used after you create a Menu object by calling print() on the Menu object. By looking at the output in the console window, you can make sure the menu was created correctly in the __init__ method. This is not required. • At this point, you should be able to test the methods in the Menu class. ITP 115 – Programming in Python 2021-04-27 Page 6 of 13 Part2–CreatingDiners • Next, define the Diner class in a file titled Diner.py. This class represents one of the diners at the restaurant and keeps tracks of their status and meal. • It will make use of MenuItem objects, so be sure to add the proper import statement. • The class will have the following class (or static) variable: o STATUSES: a list of strings containing the possible statuses a diner might have: "seated", "ordering", "eating", "paying", "leaving" • The class will use the following instance attributes: o self.name: a string containing the diner’s name o self.order: a list of the MenuItem objects ordered by the diner o self.status: an integer corresponding to the diner’s current dining status • Define the following methods: o __init__ § Parameter (1): a string containing the diner’s name § Return value: None § Set the diner’s name attribute to the input value. Set the diner’s order attribute to an empty list (the diner has not ordered any menu items yet). Set the status attribute to 0 (corresponding to a seated status). o Define get methods for all the
Answered Same DayMay 05, 2021

Answer To: Microsoft Word - ITP115_FinalProject.docx ITP 115 – Programming in Python XXXXXXXXXXPage 1 of 13...

Swapnil answered on May 06 2021
143 Votes
83169/Restaurant_Simulator/Diner.py
from MenuItem import MenuItem
from Menu import Menu
class Diner():
    STATUSES = ["seated", "ordering", "eating", "paying", "leaving"]
    def __init__(self, name):
        self.name = name
        self.order = []
        
self.status = 0
    def getName(self):
        return self.name
    def getOrder(self):
        return self.order
    def getStatus(self):
        return self.status
    def setName(self, newName):
        self.name = newName
    def setOrder(self, newOrder):
        self.order = newOrder
    def setStatus(self, newStatus):
        self.status = newStatus
    def updateStatus(self):
        self.status += 1
    def addToOrder(self, objec):
        self.order.append(objec)
    def printOrder(self):
        print(self.name, "ordered:")
        for i in self.order:
            print(i)
    def calculateMealCost(self):
        sum1 = 0
        for i in self.order:
            sum1 += i.price
        return sum1
    def __str__(self):
        string = "Diner " + self.name + " is currently " + self.STATUSES[self.status] + "."
        return string
83169/Restaurant_Simulator/menu.csv
Hummus,Appetizer,7.99,Crushed Chickpeas With Tahini Lemon Olive Oil
Tabouleh,Appetizer,5.99,Cracked Wheat Tomatoes Parsle Lemon
Falafel,Appetizer,8.99,Lightly Fried Chickpeas Parsley Onions
Baklava,Dessert,3.5,Filo Dough Crushed Walnuts Pistachios Syrup
Umm Ali,Dessert,4.99,Phyllo Pastry Milk Double Cream Nuts And Topped With Raisins Powdered Sugar And Coconut Flakes
Knafeh,Dessert,4.5,Semolina Dough Stuffed With A White Soft Cheese And Topped With Thin Noodle-Like Phyllo Pastry
Soda,Drink,1.5,Choose From Sprite Coke Or Pepsi
Arabic Coffee,Drink,3,Extra Strong and Boiled
Tea,Drink,1.5,Strong Black Tea Brewed With Sugar And Served In Long Glasses With Mint
Kibbeh Bil Seniyeh,Entree,16.99,A Layer Of Ground Meat Onions And Nuts Sandwiched Between Two Layers Of Kibbeh And Baked To Perfection
Kibbeh Swar,Entree,12.99,Cupcake Like Kibbeh Packed With Ground Meat Onions Nuts Baked To Perfection And Topped With Ground Pistachio.
Aleppo Kofta,Entree,15.99,Minced Beef Blended With Spices Char-Grilled Over Mesquite Served With Rice.
Khash-Khash,Entree,17.99,Minced Meat With Spices Char-Grilled Over Mesquite And Served Over A Spicy Tomato Sauce. Served With Rice.
Shawarma,Entree,13.99,Grilled Strips Of Seasoned Beef Served With Hummus Rice And Salad
Falafel Platter,Entree,12.99,A Mixture Of Ground Chickpeas Coriander Garlic Onions And Spices Fried In Vegetable Oil. Comes With Hummus...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here