某公司为其它公司做技术服务, 人员按照客户要求出差外派。 补贴是在人员出差前预先派发 的。需要计算出每个人的补贴数值,并且需要派出日期先后排序, 以便于安排进行统一借款并进行补贴的派发。 如果派出日期相同, 则按照补贴金额从少到多 排序。 按照出差时间长短,补贴的标准是不同的。具体规定是: 30 天以内,每日补贴 50 元;超出 31 而在 60 天以内部分,每日补贴多 10 元,即 60 元;超 出 61 而在 90 天以内部分,每日补贴再多 0 即 70 元,……以 30 日为周期以此类推。 出差的天数以自然日计算,不需要考虑节假日。 举例说明: 张三 2010-9-16 外派出差, 2010-9-30 回到公司, 到 计算出差时间为 15 天, 因为少于 30 天, 出差补贴为 50*15=750 元。 李四 2010-9-1 外派出差, 2010-10-20 回到公司, 到 计算出差时间为 50 天, 50*30+60*20=2700 元。 为了方便后期调整出差补贴标准,需要采用 config.properties 对上面的补贴标准进行配置,
程序运行时从 C:\test\下读取。 配置文件的内容为: base=50 step=10 给出的输入文件为 C:\test\src.txt,每行内容为 3 部分, 派出日期 释放日期 其中:每个字段中间以一个空格分隔,日期的形式为 2010-9-17。 结果请写入 C:\test\result.txt 中, 每行内容为 5 部分: 派出日期 释放日期 出差天数 补 助金额。 其中:每个字段中间以一个空格分隔,日期的形式为 2010-9-17(注:月份或日期位数不满 2 位的,不需要以 0 补全 2 位,即 2010-9-1 不需要输出为 2010-09-01) ;出差天数、金额保 留到整数位。 输入、输出文件编码方式都使用 GBK。 提示:编程过程中,可以使用 apache commons 包中的 api (这个建议与考查的内容无关, 至少便于对处理文件关闭进行处理,评分是不会有任何影响) 除以上包以外,请使用 j2se5.0 或 6.0 的标准内容。引入其他第 3 方库并不符合考试要求。 注:考题附带文件样例,可得出文件格式等信息 config.properties base=50 step=10 src.txt 张三 2010-9-17 2010-10-15
李四 2010-9-5 2010-10-30 王五 2010-9-20 2010-11-2 赵六 2010-10-2 2010-10-30 阿童木 2010-10-15 2010-12-31 package com.neusoft.exam; import java.util.Date; /** * *
Application name:JAVA275
*
Application describing:定义旅行实体 *
Copyright:Copyright &;copy; 2012 东软 软件开发事业部版权所有。
*
Company:Neusoft
*
Date:2012-2-24
* @author 杨小军 * @version $Revision: 1.2 $ */ public class BusinessTrip implements Comparable
{ private String userName; private Date startDate; private Date endDate; private int days; private Integer allowance; public BusinessTrip(String userName, Date startDate, Date endDate, int days, int allowance) { thi
s.userName = userName; this.startDate = startDate; this.endDate = endDate; this.days = days; this.allowance = allowance; } public String getUserName() { return userName; }
public void setUserName(String userName) { this.userName = userName; } public Date getStartDate() { return startDate; } public void setStartDate(Date startDate) { this.startDate = startDate; } public Date getEndDate() { return endDate; } public void setEndDate(Date endDate) { this.endDate = endDate; } public int getDays() { return days; } public void setDays(int days) { this.days = days; } public Integer getAllowance() { return allowance; } public void setAllowance(Integer allowance) { this.allowance = allowance; }
public int compareTo(BusinessTrip o) { if (this.getEndDate() == o.getStartDate()) { return this.allowance - o.getAllowance(); } return this.getStartDate()pareTo(o.getStartDate()); } } package com.neusoft.exam; import java.io.File; impo