码迷,mamicode.com
首页 > 其他好文 > 详细

1.5 重点

时间:2017-05-09 21:39:20      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:oid   pac   info   张无忌   oat   name   mat   super   ring   

package Employ;

public class EmpDemo {
 public static void main(String[] args) {
  Emp emp =new Emp(1001,"张三丰",1000,200);
  Emp emp1 = new Emp(1002,"张无忌",2000,300);
  System.out.println(emp.Information());
  System.out.println(emp1.Information()); 
 } 
}
class Emp{
 private int  empno ;
 private String name ;
 private float salary ;
 private float bonus ;
 
 public Emp() {}
 
 public Emp(int empno, String name, float salary, float bonus) {
  super();
  this.empno = empno;
  this.name = name;
  this.salary = salary;
  this.bonus = bonus;
 }
 
 public int getEmpno() {
  return empno;
 }
 public void setEmpno(int empno) {
  this.empno = empno;
 }
 public String getName() {
  return name;
 }
 public void setName(String name) {
  this.name = name;
 }
 public float getSalary() {
  return salary;
 }
 public void setSalary(float salary) {
  this.salary = salary;
 }
 public float getBonus() {
  return bonus;
 }
 public void setBonus(float bonus) {
  this.bonus = bonus;
 }
 
 public float salary1(){   //月薪
  return  salary+bonus;
  
 }
 
 public float daily(){   //日薪
  return this.salary1()/30;
  
 }
 
 public float income(){   //年薪
  
  return this.salary1()*12;
 }
 
 public String Information(){
  return   "员工信息:\n"+"\tl- 员工编号:"+this.getEmpno()+"\n"+"\tl- 员工姓名"+this.getName()+"\n"+"\tl- 员工薪水:"+this.getSalary()+"\n"+"\tl- 奖金:"+this.getBonus()+
      "\n"+"\tl- 日薪:"+this.daily()+"\n"+"\tl- 月薪:"+this.salary1()+"\n"+"\tl- 年薪:"+this.income();
  
 }
 
 
 
}

1.5 重点

标签:oid   pac   info   张无忌   oat   name   mat   super   ring   

原文地址:http://www.cnblogs.com/mengliang/p/6832645.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!