add a method calculate pay() to the employee class. the method should return the amount to pay the employee by multiplying the employee's wage and number of hours worked.

Respuesta :

To add a method calculate pay() to the employee class. the method should return the amount to pay the employee by multiplying the employee's wage and number of hours worked, check the code given below.

What is class?

In object-oriented programming, a class is a template definition of the method(s) and variable(s) in a particular kind of object. As a result, an object is a unique instance of a class and contains real values rather than variables.

The class is one of the core ideas in object-oriented programming. The following are some essential ideas about classes:

A class's subclasses are able to take on all or some of its parent class's characteristics. In relation to each subclass, the class becomes the superclass.

Subclasses can define their own methods and variables independently of their superclass as well.

The term "class structure" refers to the relationship between a class and its subclasses.

//CODE//

class Employee:

    def __init__(self):

        self.wage = 0

        self.hours_worked = 0

     def calculate_pay(self):

        return self.wage * self.hours_worked

  alice = Employee()

alice.wage = 9.25

alice.hours_worked = 35

print('Alice:\n Net pay: %f' % alice.calculate_pay())

 bob = Employee()

bob.wage = 11.50

bob.hours_worked = 20

print('Bob:\n Net pay: %f' % bob.calculate_pay())

Learn more about class

https://brainly.com/question/9949128

#SPJ4