導航:首頁 > 編程語言 > java中的計費項目

java中的計費項目

發布時間:2024-10-27 14:28:20

『壹』 用java編寫一個電話計費卡程序

importjava.util.Scanner;


publicclassPhoneCard{
privatefinalintid;//卡號
privatefinalintpassword;//密碼
privatedoublecash;//剩餘金額
privatedoublecashPerMin=0.2;//每分鍾收費
privateScannersc=newScanner(System.in);

publicPhoneCard(intid,intpassword,doublecash){
this.id=id;
this.password=password;
this.cash=cash;
}

/**
*撥號計費
*@paramtime撥號時間單位分鍾
*返回剩餘金額
*/
publicdoublecallSomeone(doubletime){
System.out.println("請輸入卡號和密碼,用空格隔開");
intid=sc.nextInt();
intpw=sc.nextInt();
if(this.id==id&&this.password==pw){
this.cash=this.cash-(double)time*cashPerMin;
returncash;
}else{
System.out.println("密碼錯誤");
return-1;
}
}
}

publicclassTestPhoneCard{
publicstaticvoidmain(String[]args){
PhoneCardpc=newPhoneCard(1,1,100);//初始化,卡號,密碼,余額
doublemoney=pc.callSomeone(10);//撥打10分鍾
System.out.println("余額為"+money+"元");
money=pc.callSomeone(90);//繼續撥打
System.out.println("余額為"+money+"元");
}
}

不知道為什麼沒人做

『貳』 請教高手JAVA做電信的計費系統

首先要確定所用的技術 框架

先寫 實體類 在創建 資料庫里的表格,然後建立 hibernate映射文件,寫DAO

再寫Action Struts配置文件

最後寫JSP文件

『叄』 java編程問題: 某城市用水實行階梯計費,規則如下:對於生活用水:如

publicclassWaterRate{
inttype;
intquantity;
publicWaterRate(inttype,intquantity){
super();
this.type=type;
this.quantity=quantity;
}
publicdoublecalc(){
doublecash=0;
if(type==1){
if(quantity>10){
cash=10*2.5+(quantity-10)*3;
}else{
cash=quantity*2.5;
}
System.out.print("生活用水"+quantity+"噸,總計:");
}elseif(type==2){
if(quantity>20){
cash=10*3.9+(quantity-10)*4.8;
}else{
cash=quantity*3.9;
}
System.out.print("商業用水"+quantity+"噸,總計:");
}else{
System.out.println("請輸入正確的類型(1生活用水2商業永碩)");
}
System.out.println(cash+"元");
returncash;
}
publicstaticvoidmain(String[]args){
newWaterRate(1,16).calc();
newWaterRate(2,35).calc();
}
}
之前就回答你了╮(╯_╰)╭

『肆』 一個簡單的Java程序代碼

public double GetCost(int minutes)
{
//整數時間所花的費用
int aa = minutes / 60; //未滿1小時處理
if (minutes < 60)
return 2;

//超出小時部分
int bb = minutes % 60; //其實你還有必要做一些其他處理。比如說超過30分鍾了該怎麼樣算等等...... return aa * 2 + bb * 0.01d;
}

閱讀全文

與java中的計費項目相關的資料

熱點內容
在哪裡解壓文件第一分卷 瀏覽:63
奧維使用教程 瀏覽:324
編程程序怎麼轉到plc上 瀏覽:807
文件名沖突但是找不到 瀏覽:261
上海瑞金醫院app下載 瀏覽:998
qq群里的機器人買武器 瀏覽:428
捕魚達人歷史版本 瀏覽:73
mp4視頻文件解密軟體 瀏覽:62
多軸編程哪個軟體最方便 瀏覽:27
老平板哪個是顯示屏數據線插座 瀏覽:849
5sing上傳音頻文件格式 瀏覽:171
win10輸入文件滑鼠右鍵異常 瀏覽:634
聽幼兒故事用什麼app 瀏覽:514
iphone修改音頻文件名 瀏覽:53
國家氣象站點數據在哪裡下載 瀏覽:342
網路設置的網站 瀏覽:914
手機測量放樣怎麼導數據和線型 瀏覽:648
企業展示型網站源碼 瀏覽:781
易花花app哪裡下載 瀏覽:323
外國程序員職業生涯長 瀏覽:709

友情鏈接