📄 count.java
字号:
package com.jbaptech.accp.netbar.client;
//下机界面CheckOutDialog按下确定时调用此类的方法
public class Count {
public Count() {
}
public static int calFee(String beginTime, String endTime){
int fee = 0; //消费金额
//从字符串形式的日期获取年、月、日、小时、分
int beginYear = Integer.parseInt(beginTime.substring(0,4));
int beginMonth = Integer.parseInt(beginTime.substring(5,7));
int beginDay = Integer.parseInt(beginTime.substring(8,10));
int beginHour = Integer.parseInt(beginTime.substring(11,13));
int beginMinute = Integer.parseInt(beginTime.substring(14,16));
int endYear = Integer.parseInt(beginTime.substring(0,4));
int endMonth = Integer.parseInt(beginTime.substring(5,7));
int endDay = Integer.parseInt(beginTime.substring(8,10));
int endHour = Integer.parseInt(beginTime.substring(11,13));
int endMinute = Integer.parseInt(beginTime.substring(14,16));
//计算上机的时间,单位为分钟
int playMinutes = 0;
playMinutes = ( (endYear - beginYear) * 365 * 24 * 60 +
(endMonth - beginMonth) * 30 * 24 * 60 +
(endDay - beginDay) * 24 * 60 +
(endHour - beginHour) * 60 +
(endMinute -beginMinute));
//计算费用
int modNum = playMinutes % 60;
int playHours = 0;
playHours = playMinutes / 60;
if (playHours == 0 || (modNum > 5 && playHours > 0)){
playHours++;
}
fee = playHours * 2;
return fee;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -