about summary refs log tree commit diff
path: root/usth/ICT2.2/labwork/4/Employee.java
blob: 51647b5b897293de879ffa0021aa288191144e49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
public class Employee
{
  private int ID;
  private String name;
  private String dep;
  private double basic;
  private double extra;

  public Employee(int ID, String name, String dep, double basic, double extra)
  {
    this.ID = ID;
    this.name = name;
    this.dep = dep;
    this.basic = basic;
    this.extra = extra;
  }

  public int getID() { return ID; }
  public String getName() { return name; }
  public String getDep() { return dep; }
  public double getIncome() { return basic + extra*2.5; }

  public String toString()
  {
    return String.format("#%d %s [%s]: %g", ID, name, dep, getIncome());
  }
}