Home / Expert Answers / Computer Science / task-2-10-marks-the-following-uml-diagram-shows-a-new-class-called-employee-extending-from-the-p-pa565

(Solved): Task 2 (10 marks) The following UML diagram shows a new class called Employee extending from the p ...



Task 2 (10 marks)
The following UML diagram shows a new class called Employee extending from the previously written Person clDerive a new class called Employee from the Person class written in Task 1 . The Employee should inherit all of Persons vari

Task 2 (10 marks) The following UML diagram shows a new class called Employee extending from the previously written Person class. Derive a new class called Employee from the Person class written in Task 1 . The Employee should inherit all of Person's variables and methods. Please implement this class based on the requirements below: -___init__(name, age, money, jobTitle, wage) - constructor calls the super constructor with appropriate arguments, then sets jobTitle and wage to the arguments, and sets hours to 0. - getJobTitle() - returns the jobTitle attribute. - setWage(wage) - Sets the wage attribute to the argument if it is a positive number. - work(numHours) - increases the hours attribute by the given numHours. - receivePay() - increases the inherited money attribute by hours * wage. Then sets hours to zero. Create an instance of Employee and test each method. You may start with the code below: ada = Employee('Ada', 36, 3000, 'mathematician', 40) print(ada.getJobTitle()) ada.work(8) ada.receivePay() print(\$ + str(ada.getMoney())) ada.setWage(100) ada.work(8) ada.receivePay() print(\$ + str(ada.getMoney())) ada.die()


We have an Answer from Expert

View Expert Answer

Expert Answer


The following code in python: #this is parent class class Person: def __init__(self,name,age,money): self.name = name self.age = age self.money = mone
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe