?? count.java~1~
字號:
package com.jbaptech.accp.netbar.client;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: 北京阿博泰克北大青鳥信息技術有限公司</p>
*
* @author Michael Luo
* @version 1.0
*/
public class Count {
public Count() {
}
private 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 + -