Employee Class
The task is to implement a class Employee
that represents the data and operations of an employee in a company. An Employee
has four attributes:
name
: a string that represents the name of the employee.id
: a string that represents the employee id.department
: a string that represents the department of the employee.salary
: a float that represents the monthly salary of the employee.
The Employee
class should have the following methods:
get_details()
: Returns a string representation of anEmployee
. This string should contain thename
,id
, anddepartment
of theEmployee
with the following format: “Name: <NAME>, ID: <ID>, Department: <DEPARTMENT>”.calculate_annual_salary()
: Returns a float that is the annual salary of theEmployee
. The annual salary is calculated as the monthly salary multiplied by 12.
Input | Output |
---|---|
| Name: John Doe, ID: JD01, Department: Engineering |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB