问题描述
- 求大神告诉源码,真的不太会
-
面向对象来写,可是不太会,求大神源码????????????????????????????????????????????????????????????????????????
解决方案
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());
}
}
解决方案二:
楼主还是退出it界吧
解决方案三:
转行或者换专业吧!编程不适合你!
而且你也没有编程人的思维方式!遇到问题,先自己解决,而不是问别人,求救!更不能要源代码!
解决方案四:
你是一点Java都不会吧
解决方案五:
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 + "]";
}
}
解决方案六:
这题很简单,跟楼上一样
解决方案七:
多看看书吧,多敲桥代码,即使是照着敲,总会顿悟的
解决方案八:
你是在考试吗?还是多看书吧。