Given the following snippets of code, evaluate the print statements: (assume python 3.X)
Class Descriptions
class Business
-Constructor takes two positional arguments, name and starting captial. It should
initialize a list of employees to be empty and a clock-timer(int{hours) to start at
midnight (0 ! 23).
-hire adds an employee object to the employee list hire advanceHour adds one
to the clock attribute, cycling back to 0 when appropriate, also if any employee
has finished their shift (worked 8 hours) then get the amount of pay owed to them
to subtract from the captial balance (can go negative)
-a String representation should be in the format:
<clock>:00 - <name> has $<amount>.00 in capital
class Resaurant extends from Business
-Constructor takes the same parameters of the attribute and initializes everything
as was done in the parent, but has 3 new empty lists: food wanted by patrons,
food available to serve patrons, and patrons waiting.
-attractPatron adds a patron to the list of waiting patrons, and adds all their
food wants to the list of wanted food. Print out a message that the patron entered
the restaurant
-Override the advanceHour all the prior functionality should be maintained,
but iterate through each patron, and attempt to wait on them with employees
that are on duty and not busy (food list should be modified by the wait staff).
If they become satisfied from being waited on, then remove them from the wait
list and add their bill total to the business capital. Following checking patrons,
check for food wanted...if their is staff available (same checks as above) have them
cook the food, when cooking move the food from the want list to the available
list. After patrons are waited on and food is being cooked...make all staff available
again for the next hour.
class Food
-Constructor takes two positional arguments the name of the food and the cost
The string representation should look like:
<name> $<cost>
class Patron
-The constructor should take two parameters, the patron’s name and the food they
want (given as a list of Food objects). It initializes those attributes as well as a
computed bill total needed as food wants will have items removed...
-serveFood gets a food item and removes it from the food wanted list
-isSatisfied checks to see if the patron doesn’t have anymore food wants...if empty
then they are satisfied
-getWants returns a reference to their food wants
-payBill prints out a message of the patron paying their bill and return the bill
value
-The string representation should be the name followed by all their food wants and
bill total (may not match if some items have been served since construction)
class Employee
-Constructor is initialized with a name, salary, and start time through the parameters. It also initializes two dictionaries that represent task skill levels and task
busy-ness/occupation...
-addSkill allows the employee to gain skill in a task (add to existing level) or
create a new key in the dictionary with that; when creating an entry also create
one in the busyLvl to indicate work can now be done on tasks of that nature
-onDuty given a clock time (military hour) check to see if the employee is
working (assume their shifts are 8 hours)...so is the time within 8 hours of the
start time.
-getPay returns a 8 hour shift pay
-work states that an employee works on a task for an hour (the task type must
be specifed)...also allow a variable length key word arguments to be used in subclasses.
∗ If the specifed type is not in the skill dictionary state that the employee is not
suited to do that work, and return False indicating the work was not done
∗ If the busy level equals the skill level print out a message saying that they
are too busy and return False
∗ Otherwise increase the business level of that skill and return True indicating
that the task is being worked on
-makeAvailable iterates all skills and sets the business level to 0
-isBusy if any business level equals their skill then they are busy...otherwise they
are not busy (False)
-The string representation for the employee should list all the attributes and
skills/busy-ness; Example:
1 John Noname ( Start 7) -- $12 .00 per hour
2 Skills :
3 -- 1:2 fishing
4 -- 0:1 fighting
**Above indicates he is 1 unit occupied with fishing, but his skill is 2 so he could
do more
class FoodServiceEmployee extends Employee
-behaves just like a normal employee, but has added effects when either ’serving’
or ’cooking’:
-work has been extended...still does the same checks to see if skilled or busy...if
not busy ... i.e. parent class method says you can successful work on the specifed
task...
*if serving, need a patron and the foodAvail list passed in through the keyword
arguments: print out that the patron is being waited on and remove any food
that satisfies the patron’s wants...that food must be served to the patron (so
that the patron can remove it from their list as well so that they can become
satisfied).
*if cooking, need the food they should be making...all that is needed is a print
statement stating that the employee is making that food
∗ In either case return True to say that the patron was successfully served
or the food was successfully cooked...if indicated as unskilled or busy from
the inherited method, pass on the False value so that work maintains its
functionality.
This assignment has been answered 3 times in private sessions.
Or buy a ready solution below.
© 2024 Codify Tutor. All rights reserved