Hello, when I started this I was thinking I Was doing it right, but then as I contineud to read instructions I honestly dont know how to even begin using the other code. send help. Here's the instructions. Please, I don't know what to do. Write a class named employee that has three attributes: name, age and rank_ID. Define a class constructor that initializes these attributes when creating an object of this class. Next, create four employee objects with the following attributes: “Michael”, 45, 12345 “Dwight”, 40, 23456 “Pam”, 30, 34567 “Jim”, 35, 12345 Print the employee data in any format you like for all four employees. You must use the special class method __repr__() for doing this. Next, define a function named is_higher_rank() that takes as input two employee objects. If the employees are equal (you have to use the special class method __eq__() to see if the employees are equal or not), which means that their rank_IDs are the same, this function returns the string “These employees are both at the same rank”. If one employee’s (let’s say employee1) rank_ID is less than the other’s (let’s say employee2), this function returns a string “ is senior in rank than ” (make sure your code prints the actual employee names when you do this). Otherwise, this function returns a string “ is senior in rank than ”. 1. Manually test your is_higher_rank() function with different combinations of four employees. 2. Write at least 4 automated unit test case
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Hello, when I started this I was thinking I Was doing it right, but then as I contineud to read instructions I honestly dont know how to even begin using the other code. send help. Here's the instructions. Please, I don't know what to do.
Write a class named employee that has three attributes: name, age and rank_ID. Define a class constructor that initializes these attributes when creating an object of this class. Next, create four employee objects with the following attributes:
“Michael”, 45, 12345
“Dwight”, 40, 23456
“Pam”, 30, 34567
“Jim”, 35, 12345
Print the employee data in any format you like for all four employees. You must use the special class method __repr__() for doing this.
Next, define a function named is_higher_rank() that takes as input two employee objects. If the employees are equal (you have to use the special class method __eq__() to see if the employees are equal or not), which means that their rank_IDs are the same, this function returns the string “These employees are both at the same rank”. If one employee’s (let’s say employee1) rank_ID is less than the other’s (let’s say employee2), this function returns a string “<employee1.name> is senior in rank than <employee.name2>” (make sure your code prints the actual employee names when you do this). Otherwise, this function returns a string “<employee2.name> is senior in rank than <employee.name1>”.
1. Manually test your is_higher_rank() function with different combinations of four employees.
2. Write at least 4 automated unit test cases to test your is_higher_rank() function.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images