Java讲师兼职课时费,用JAVA编程运算课时费计算=总课时数*单位课时酬金

匿名用户

1级

2010-04-13 回答

private Double price; //收费标准

private Integer class_time; //课时

private Integer level; //教师级别 1.助教,2.讲师,3.副教授,教授

private Integer service_time; //教龄

private String name; //职称名

//-------------------Method-----------------

public void setClass_time(Integer classTime) {

class_time = classTime;

}

public Double getPrice() {

return price;

}

public Integer getLevel() {

return level;

}

public Integer getService_time() {

return service_time;

}

public void setService_time(Integer serviceTime) {

service_time = serviceTime;

}

public void setLevel(Integer level) {

this.level = level;

if(level.equals(1) && service_time <= 1){price = 30.00;name="助教";}

else if(level.equals(1) && (service_time > 1 && service_time < 3)){price = 40.00;name="助教";}

else if(level.equals(1) && service_time > 3){price = 50.00;name="助教";}

else if(level.equals(2) && service_time <= 1){price = 40.00;name="讲师";}

else if(level.equals(2) && (service_time > 1 && service_time < 3)){price = 60.00;name="讲师";}

else if(level.equals(2) && service_time > 3){price = 80.00;name="讲师";}

else if(level.equals(3) && service_time <= 1){price = 60.00;name="教授";}

else if(level.equals(3) && (service_time > 1 && service_time < 3)){price = 80.00;name="教授";}

else if(level.equals(3) && service_time > 3){price = 120.00;name="教授";}

}

public Calculate(){}

public Calculate(Integer class_time,Integer level,Integer service_time)

{

this.class_time = class_time;

this.level = level;

this.service_time = service_time;

}

public void Charging()

{

Double result = 0.0;

try

{

result = price * class_time;

}

catch (NumberFormatException nfe)

{

nfe.printStackTrace();

System.out.println("计算出错:\t"+nfe);

}

catch (Exception ex)

{

ex.printStackTrace();

System.out.println(ex);

}

String str = "该"+name+"工龄"+service_time+"年,每课时"+price+"元,总共授课课时为"+class_time+"小时,总计"+result+"元";

System.out.println(str);

}

//--------------------测试方法----------------------

public static void main(String[] args) throws Exception {

Calculate cl = new Calculate();

cl.setService_time(2);

cl.setClass_time(20);

cl.setLevel(3);

cl.Charging();

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值