实验五 - 继承与接口(3)

2020-03-27 06:12

}

package SFifth;

public class Vehicle { }

package SFifth;

public class VehicleTest {

public static void main(String[] args) {

// TODO Auto-generated method stub

Vehicle v=new Vehicle(\,\,200.0); v.run();

private String brand=\;//汽车品牌 private String color=\;//汽车颜色 private double speed=0;//汽车时速 public String getColor() { }

public void setColor(String color) { }

public double getSpeed() { }

public void setSpeed(double speed) { }

public String getBrand() { }

public Vehicle(String brand, String color, double speed) { }

public void run(){

System.out.println(brand+\汽车的时速为:\+speed); }

// TODO Auto-generated constructor stub this.brand=brand; this.color=color; this.speed=speed; return brand; this.speed = speed; return speed; this.color = color; return color;

}

}

实验结果

实验六

package SSixth;

public class ColaEmployee {

}

int getSalary(int month){

if (month == this.month) {

}

}

public void setMonth(int month) { }

this.month = month; public int getMonth() { }

return month;

public void setName(String name) { }

this.name = name; String name;//员工姓名 int month;//员工生日月份

public String getName() { }

return name;

return 100;

else {

return 0;

}

package SSixth;

public class Company extends ColaEmployee{ }

package SSixth;

public class HourlyEmployee extends ColaEmployee { {

}

public double getHours() { }

public void setHours(double hours) { }

public double getHsalary() { }

public void setHsalary(double hsalary) { }

public int getSalary(int month){

if(this.hours<=160){

this.hsalary=this.hsalary*this.hours+super.getSalary(month); c.print(name,hsalary,month); return 0;

this.hsalary = hsalary; return hsalary; this.hours = hours; return hours;

// TODO Auto-generated constructor stub this.hours=hours; this.hsalary=hsalary; this.month=month; this.name=name;

double hours;//每月工作的时间 double hsalary;//每小时的工资 Company c=new Company();

public HourlyEmployee(String name,int month, double hours, double hsalary) void print(String name, double salary,int month){ }

String Name=name; double Salary=salary; int Month=month;

System.out.println(\员工\+Name+\在\+Month+\月\+\的薪资为:\+Salary);

}

}

else {

this.hsalary=(this.hours-160)*this.hsalary*1.5+160*this.hsalary+super.g }

}

c.print(name,hsalary,month); return 0;

etSalary(month);

package SSixth;

public class SalariedEmployee extends ColaEmployee { }

package SSixth;

public class SalesEmployee extends ColaEmployee{ {

// TODO Auto-generated constructor stub this.money=money; double money;//月销售额 double ticheng;//提成率 Company c=new Company();

public SalesEmployee(String name, int month, double money, double ticheng) public int getSalary(int month) {

this.salary=salary + super.getSalary(month); c.print(name,salary,month);

return 0; }

public SalariedEmployee(String name, int month, double salary) { }

// TODO Auto-generated constructor stub this.name=name; this.month=month; this.salary=salary;

double salary;//员工固定薪资(按月) Company c=new Company();

}

}

this.month=month; this.name=name; this.ticheng=ticheng;

public double getMoney() { }

public void setMoney(double money) { }

public double getTicheng() { }

public void setTicheng(double ticheng) { }

public int getSalary(int month) {

this.money= money + super.getSalary(month)+(money*ticheng); c.print(name,money,month); return 0; }

this.ticheng = ticheng; return ticheng; this.money = money; return money;

package SSixth;

public class SalesEmployee extends ColaEmployee{ {

}

public double getMoney() { }

public void setMoney(double money) { }

public double getTicheng() {

this.money = money; return money;

// TODO Auto-generated constructor stub this.money=money; this.month=month; this.name=name; this.ticheng=ticheng; double money;//月销售额 double ticheng;//提成率 Company c=new Company();

public SalesEmployee(String name, int month, double money, double ticheng)


实验五 - 继承与接口(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:数学课堂教学方法的多样性-精选教育文档

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: