Part 1

Pet Class

Write a class named Pet, which should have the following attributes:

  • __name(for the name of a pet)
  • __animal_type(for the type of animal that a pet is. Example values are 'Dog', 'Cat', and 'Bird')
  • __age(for the pet's age)

The Pet class should ahve an __init__ method that creates these attributes. It should also have the following methods:

  • set_name
    This method assigns a value to the __name field.
  • set_animal_type
    This method assigns a value to the __animal_type field.
  • set_age
    This methods assigns a value to the __age field.
  • get_name
    This method returns the value of the __name field.
  • get_animal_type
    This method returns the value of the __animal_type field.
  • get_age
    This method returns the value of the __age field.

Once you have written the class, write a program that creates an object of the class and prompts the user to enter the name, type, and age of his or her pet. This data should be stored as the object's attributes. Use the object's accessor methods to retrieve the pet's name, type, age, and display the data on the screen.

Part 2

A System to Manage Employees using a Class and a Dictionary

Write a Python program that stores 'Employee' objects in a dictionary. (You MUST use the class we created when we created Employee class for Programming Exercise 4. Your class must be called 'Employee' and stored inside a Python module named emp.py). Use the employee ID number as the key. The program should present a main menu that allows the user to execute the following actions and looks like Figure 1: see image.

Your main program must be called MainEmployee.py. Upon exiting the program, it must pickle the dictionary and save it to a file. Each time the program starts, it must try to load the pickled dictionary from the file. If the file does not exist, the program must start with an empty dictionary (in other words create an empty dictionary if one does not exist by the name employees.dat.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.