Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Polymorphism with Stores -Python The goal of this program is to make classes that represent to a certain degree different types of stores in real

  1. Polymorphism with Stores -Python
  2. The goal of this program is to make classes that represent to a certain degree different types of stores in real life and the information tracked and services provided by these stores. In order to accomplish this the following required classes have to be created:
  3. First file should be called store.py which contains an abstract class called Store which is made up of the following:
  • Attributes/Propertieso Store name o Store address
  • Store availability/status (open or closed) o Sales tax percentage
  • Functions/Functionalityo Constructor which provides the ability to pass and set the values for the various attributes
  • Getter and setters for all the attributes mentioned above
  • is_store_open should return True if the store is open and False if the store is closed
  • Abstract function called: calculate_total_sales_tax o Abstract function called calculate_total_sales
  1. Second file should be called restaurant.py which contains a class called Restaurant which is type of Store. It should possess all the attributes and functions present in the Store class without having to re-implement those in the Restaurant class. The Restaurant class is made up of the following:
  • Attributes/Propertieso Total number of people served
  • Max occupancy o Current occupancy o Price per person
  • Functions/Functionalityo Constructor which provides the ability to pass and set the values for the various attributes
  • seat_patrons should do the following:
  • Take the number of people to be seated as input
  • Update the values of the appropriate attributes
  • If number of people to be seated does not exceed or equals the max occupancy
  • Print "Welcome to [replace with name of restaurant]" Return True
  • If number of people to be seated exceeds the max occupancy
  • Print "We are at capacity, we appreciate your patience"
  • Return False
  • serve_patrons which should do the following:
  • Take the number of people to serve as input
  • Update the values of the appropriate attributes
  • Return the number of people being served currently o checkout_patrons (this is when the patrons are ready to leave the restaurant) which should do the following:
  • Take the number of people leaving as input
  • Update the values of the appropriate attributes
  • Return the current occupancy of the restaurant oAdda getter and setter for the attribute: Price per person
  1. Third file should be called grocery_store.py which contains a class called GroceryStore which is type of Store. It should possess all the attributes and functions present in the Store class without having to re-implement those in the GroceryStore class. The GroceryStore class is made up of the following:
  • Attributes/Propertieso Total revenue
  • Grocery store type (independent or chain)
  • Functions/Functionalityo Constructor which provides the ability to pass and set the values for the various attributes
  • sell_item which should do the following:
  • Takes the quantity and price of an item as input
  • Update the values of the appropriate attributes
  • Return the total revenue of the grocery store o adda getter and setter for the attribute: Grocery Store type
  1. Last file should be called shopping.py which will make use of the above mentioned Restaurant and GroceryStore classes and call their various functions to simulate the actions which take place in real life restaurants and grocery stores in order to test your code.

Do not forget to implement the two abstract functions specified in the Store class within each of the classes mentioned above

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

Students also viewed these Programming questions

Question

The supporting and nurturing cells found in brains are........?

Answered: 1 week ago

Question

Q.1. Taxonomic classification of peafowl, Tiger and cow ?

Answered: 1 week ago

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago