2 dyxm21 dyxm21 于 2016.04.15 09:57 提问

求大神告诉源码,真的不太会

面向对象来写,可是不太会,求大神源码⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯图片说明

8个回答

java6218
java6218   2016.04.15 10:39
已采纳

package com.njupt.www;

import java.util.Date;

public class Employee {
private int num;
private String name;
private String position;
private String date;
private float basic_salary;
private float award;
public Employee()
{
super();
}
public Employee(int num,String name,String position,String date,float basic_salary,float award)
{
super();
this.num=num;
this.name=name;
this.position=position;
this.date=date;
this.basic_salary=basic_salary;
this.award=award;
}
public int getNum() {
return num;
}

public void setNum(int num) {
    this.num = num;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getPosition() {
    return position;
}

public void setPosition(String position) {
    this.position = position;
}

public String getDate() {
    return date;
}

public void setDate(String date) {
    this.date = date;
}

public float getBasic_salary() {
    return basic_salary;
}

public void setBasic_salary(float basic_salary) {
    this.basic_salary = basic_salary;
}

public float getAward() {
    return award;
}

public void setAward(float award) {
    this.award = award;
}

public float getSalary(float basic_salary, float award){
    return basic_salary+award;
}
@Override
public String toString() {
    return "Employee [num=" + num + ", name=" + name + ", position=" + position + ", date=" + date
            + ", salary=" + getSalary(basic_salary , award) + "]";
}

}
//测试
package com.njupt.www;

public class Test {

public static void main(String[] args) {
    Employee employee = new Employee(1001,"李雷","经理","2016-04-15",8000,2000);
    System.out.println(employee.toString());


}

}

baidu_23086307
baidu_23086307   2016.04.15 15:17

楼主还是退出it界吧

DarrenMJ
DarrenMJ   2016.04.15 16:37

转行或者换专业吧!编程不适合你!
而且你也没有编程人的思维方式!遇到问题,先自己解决,而不是问别人,求救!更不能要源代码!

u010515202
u010515202   2016.04.15 10:07

你是一点Java都不会吧

java6218
java6218   2016.04.15 10:31

package com.njupt.www;

import java.util.Date;

public class Employee {
private int num;
private String name;
private String position;
private Date date;
private float basic_salary;
private float award;
public Employee()
{
super();
}
public Employee(int num,String name,String position,Date date,float basic_salary,float award)
{
super();
this.num=num;
this.name=name;
this.position=position;
this.date=date;
this.basic_salary=basic_salary;
this.award=award;
}
public int getNum() {
return num;
}

public void setNum(int num) {
    this.num = num;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getPosition() {
    return position;
}

public void setPosition(String position) {
    this.position = position;
}

public Date getDate() {
    return date;
}

public void setDate(Date date) {
    this.date = date;
}

public float getBasic_salary() {
    return basic_salary;
}

public void setBasic_salary(float basic_salary) {
    this.basic_salary = basic_salary;
}

public float getAward() {
    return award;
}

public void setAward(float award) {
    this.award = award;
}

public float getSalary(float basic_salary, float award){
    return basic_salary+award;
}
@Override
public String toString() {
    return "Employee [num=" + num + ", name=" + name + ", position=" + position + ", date=" + date
            + ", basic_salary=" + basic_salary + ", award=" + award + "]";
}

}

woran7867
woran7867   2016.04.15 11:17

这题很简单,跟楼上一样

qq_24334403
qq_24334403   2016.04.15 17:08

多看看书吧,多敲桥代码,即使是照着敲,总会顿悟的

changboyuan2015
changboyuan2015   2016.04.15 17:42

你是在考试吗?还是多看书吧。

Csdn user default icon
上传中...
上传图片
插入图片