Skip to content

Employee and Company

classDiagram
    class BankInfo {
        -String number
        -String bankName
        +BankInfo(number, bankname)
    }
    class Status {
        -boolean manager
        -int year
        +Status(year)
        +Status(year, manager)
    }
    class Employee {
        -int id
        -String firstName
        -String lastName
        -float salary
        +Employee(id, firstname, lastName, salary, bankInfo, status)
    }
    class Company {
        -String name
        +Company(String name)
        +add(Employee employee)
    }
    Employee "1" --> "1" BankInfo
    Employee "1" --> "1" Status
    Company "1" --> "0..*" Employee

Organization that employs multiple employees.

  • Can have zero or more employees (one-to-many relationship)
  • Method to add employees to the company
  • Private properties have getters and setters

Represents an employee with personal and financial information.

  • Has one BankInfo (1:1 relationship)
  • Has one Status (1:1 relationship)
  • Belongs to one Company
  • Private properties have getters and setters

Employee’s banking information.

  • Associated with exactly one Employee
  • Private properties have getters and setters

Employee’s work status (manager or not, years of service).

  • Associated with exactly one Employee
  • Constructor overloading for different initialization
  • Private properties have getters and setters