Question
Write three object-oriented classes to simulate your own kind of team in which a senior member type can give orders to a junior member type
Write three object-oriented classes to simulate your own kind of team in which a senior member type can give orders to a junior member type object, but both senior and junior members are team members. So, there is a general team member type, but also two specific types that inherit from that general type: one senior and one junior.
Write a Python object-oriented class definition that is a generic member of your team. For this writeup we call it X.
It captures the data and actions that are common to all team members. The team member class is not specific to any kind of team member. Name the class appropriately for its purpose. It defines what is common about all team members, for example a string variable to hold a name.
This class definition must include the following:
Define a constructor function to create objects built from this class. The statements in the block of this function must declare and initialize all TeamMember class variables.
Declare and initialize a class data variable to hold the name of the character as a string. Set its initial value to an empty string.
Define another Python class that inherits from the team member class X, so it will get all data and functions from X For this writeup we will call this class SeniorX. This class is a more specific type of team member that is senior ranking Name the class appropriately for its purpose.
This class definition must include the following:
One function as a constructor. In the block declare/initialize all class data variables, defined here or inherited.
Declare/initialize a data variable that means something unique to this type of team member (your choice).
Define a function for giving an order to a junior member this function accepts as parameter a junior team member type object.
In the indented block of statements do the following:
Print out the order being given (a string. You can use a constant string like Do a push up), and the name of the junior member that will receive the order.
Call the order receiving function on the junior member object, passing in the order.
Define another Python class that inherits from the team member class X For this writeup we will call this class JuniorX. This class is a more specific type of team member that is a junior team member who takes orders from senior members.
The indented block for this function must include:
One constructor function. The block of statements for this function must set the value of all class data variables, defined here or inherited.
In the constructor declare/initialize one data variable unique to this type of team member (your choice).
Define a function for receiving an order from a senior member: This function accepts as parameter a string of orders. In the statement block for this function definition complete the order by printing it out along with the name of the junior member who is completing the order.
Outside and after your class definitions, write a main function definition to demonstrate using the classes. Its header line would be like def main (): In the indented block for main, write statements that do the following:
Call the senior team member constructor function to create a senior team member object and save it in a variable.
Call the junior team member constructor function to create a junior team member object and save it in a variable.
Call the order giving function from a senior member object, passing in the junior member object.
Finally, using SQLite3 figure out how to save one of your objects into a database within your codes directory and then retrieve it back out of the database, then print out its contents.
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