You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.0 KiB
49 lines
1.0 KiB
package Homework;
|
|
|
|
public class Employee {
|
|
private String id;
|
|
private String name;
|
|
private String department;
|
|
private double salary;
|
|
public Employee(String id, String name, String department){
|
|
this.id = id;
|
|
this.name = name;
|
|
this.department = department;
|
|
}
|
|
public void setSalary(double salary){
|
|
if (salary>=2000){
|
|
this.salary = salary;
|
|
}
|
|
}
|
|
public double getSalary(){
|
|
return salary;
|
|
}
|
|
public void setDepartment(String department){
|
|
this.department = department;
|
|
}
|
|
public String getDepartment(){
|
|
return department;
|
|
}
|
|
public void setName(String name){
|
|
this.name = name;
|
|
}
|
|
public String getName(){
|
|
return name;
|
|
}
|
|
public void setId(String id){
|
|
this.id = id;
|
|
}
|
|
public String getId(){
|
|
return id;
|
|
}
|
|
public void raiseSalary(double percent){
|
|
double newSalary=this.salary*(1+percent/100);
|
|
if (newSalary>=2000){
|
|
this.salary = newSalary;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|