求高手 给予 程序案例!
解决方案 »
- java多线程的wait()和notify问题
- String中替换特殊字符的问题
- 得到子窗体对象!
- 关于调用系统程序和Query String类的问题?
- 请问THINKING IN JAVA的第2版和第3版差在什么地方,谢谢
- 入门新手求教int和long的取值范围
- Java中的Applets是否可以和其它机器通信?
- 大家谁有完整的win2000下配置tomcat3.2.4作web服务器的文档,谢谢!
- Applet可否控制HTML页面上的内容?
- 由于本人函授本科,期末JAVA两题编程不会写,楼主只会C。望高手们帮忙一下,明早一大早就要考试了,坐等
- short 和byte 转换问题
- 阿里云本科毕业生的工资?
public class Employee { private int id;
private String name;
private double salary;
private double byPercent;
public Employee(int id,String name,double salary,double byPercent){
this.id = id;
this.name = name;
this.salary = salary;
this.byPercent = byPercent;
}
public int getId(){
return id;
}
public void setId(int id) {
this.id = id;
} public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public double getByPercent() {
return byPercent;
}
public void setByPercent(double byPercent) {
this.byPercent = byPercent;
}
public double raiseSalary(){
return salary += salary * byPercent/100;
} public static void main(String[] args) {
Employee e1 = new Employee(00001,"张三",1500,20);
Employee e2 = new Employee(00002,"李四",2000,30);
System.out.println("编号"+" "+"员工"+" "+"基本工资"+" "+"增长率%"+" "+"总额");
System.out.println(e1.getId()+" "+e1.getName()+" "
+e1.getSalary()+" "+e1.getByPercent()+" "+ e1.raiseSalary());
System.out.println(e2.getId()+" "+e2.getName()+" "
+e2.getSalary()+" "+e2.getByPercent()+" "+ e2.raiseSalary());
}}