Employee

o1.classes.Employee
class Employee(var name: String, val yearOfBirth: Int, var monthlySalary: Double)

The class Employee represents employees (in an imaginary accounting app). Each employee has a number of attributes such as name and monthly salary. Most of these attributes are mutable.

Parameters

monthlySalary

the monthly salary of the employee, in euros and excluding any incidental costs

name

the name of the employee

yearOfBirth

the year the employee was born

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def ageInYear(year: Int): Int

Returns the number of years the employee turns during the given year.

Returns the number of years the employee turns during the given year.

Attributes

Returns a description that contains some basic employee information.

Returns a description that contains some basic employee information.

Attributes

def monthlyCost(multiplier: Double): Double

Returns the monthly cost of the employee to the employer. This figure equals the product of the employee’s monthly salary (e.g., 4000), their working time (e.g., 0.6), and a multiplier for incidental costs (e.g., 1.3).

Returns the monthly cost of the employee to the employer. This figure equals the product of the employee’s monthly salary (e.g., 4000), their working time (e.g., 0.6), and a multiplier for incidental costs (e.g., 1.3).

Parameters

multiplier

a multiplier used by the employer to estimate the additional costs of employing a person, apart from their salary

Attributes

def raiseSalary(multiplier: Double): Unit

Modifies the employee’s salary by multiplying it with the given factor. A parameter value of 1.2 will produce a 20% raise, for instance.

Modifies the employee’s salary by multiplying it with the given factor. A parameter value of 1.2 will produce a 20% raise, for instance.

Attributes

Concrete fields

var name: String

working time relative to a full week. E.g., 1.0 means a full-time employee and 0.5 a half-timer.

working time relative to a full week. E.g., 1.0 means a full-time employee and 0.5 a half-timer.

Attributes