![C銀行管理系統(tǒng)_第1頁(yè)](http://file4.renrendoc.com/view/597994ae9fd60c996290756175e771de/597994ae9fd60c996290756175e771de1.gif)
![C銀行管理系統(tǒng)_第2頁(yè)](http://file4.renrendoc.com/view/597994ae9fd60c996290756175e771de/597994ae9fd60c996290756175e771de2.gif)
![C銀行管理系統(tǒng)_第3頁(yè)](http://file4.renrendoc.com/view/597994ae9fd60c996290756175e771de/597994ae9fd60c996290756175e771de3.gif)
![C銀行管理系統(tǒng)_第4頁(yè)](http://file4.renrendoc.com/view/597994ae9fd60c996290756175e771de/597994ae9fd60c996290756175e771de4.gif)
![C銀行管理系統(tǒng)_第5頁(yè)](http://file4.renrendoc.com/view/597994ae9fd60c996290756175e771de/597994ae9fd60c996290756175e771de5.gif)
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
實(shí)驗(yàn)六數(shù)組編程練習(xí)姓名:劉帆學(xué)號(hào):082550日期:2010/12/2實(shí)驗(yàn)名稱(chēng):繼承與多態(tài)成績(jī):一、實(shí)驗(yàn)?zāi)康呐c要求實(shí)驗(yàn)?zāi)康?。認(rèn)識(shí)數(shù)組的看法,掌握數(shù)組的聲明、初始化方式;2。熟練掌握f(shuō)oreach語(yǔ)句的用法,理解params要點(diǎn)字的使用;4。掌握數(shù)組變換方法的使用;5。理解索引器的看法,掌握在整數(shù)索引和在字符串上索引的應(yīng)用。實(shí)驗(yàn)要求1。調(diào)試程序,要給出測(cè)試數(shù)據(jù)和實(shí)驗(yàn)結(jié)果。整理上機(jī)步驟,總結(jié)經(jīng)驗(yàn)和領(lǐng)悟。完成實(shí)驗(yàn)日志和上交程序。二、實(shí)驗(yàn)環(huán)境Windows7三、實(shí)驗(yàn)源程序及要點(diǎn)代碼講解namespace實(shí)驗(yàn)六{classAccount//帳戶(hù)類(lèi){intAccountNumber;//帳戶(hù)帳號(hào)doubleBalance;//本金doubleCurrentInterestRate;
//當(dāng)前利率;doubletotalInterestPaid
;//
總支付利息//屬性public
int
AAcountNumber{get{returnAccountNumber;}set{AccountNumber=value;}}publicdoubleABalance{getset
{return{Balance=
Balance;value;}
}}publicdoubleACurrentInterestRate{get{returnCurrentInterestRateset{CurrentInterestRate=
;}value;}}publicdoubleAtotalInterestPaid{get{returntotalInterestPaid;}set{totalInterestPaid=value;}}構(gòu)造函數(shù)publicAccount(intAN,doubleBa){AccountNumber=AN;Balance=Ba;}}classBank//銀行類(lèi){doubletotalPaid;//銀行付的總利息Account[]accounts=newAccount[100];//構(gòu)造函數(shù)publicBank(){}〈summary>更正〈/summary〉<paramname="no">〈/param〉〈paramname="AN”></param〉<paramname="Ba”〉〈/param〉publicBank(intno,int[]AN,double[]Ba){for(inti=0;i<no;i++){Accounttmp=newAccount(AN[i],Ba[i]);accounts[AN[i]]=tmp;}}〈summary>更正〈/summary〉<paramname=”no"></param〉〈paramname="AN"〉</param〉<paramname=”Ba”〉〈/param〉設(shè)置帳戶(hù)的利率public
voidSetInterestRate
(intnum,intcir){if
(cir==0
)
accounts[num
].ACurrentInterestRate=0.0288;//活期存款,利率為2.88%elseif(cir==1)accounts[num].ACurrentInterestRate=0。0324;//死期存款,利率為3.24%elseConsole.WriteLine("Error");}利息計(jì)算方法public
doubleInterestPaid
(intnum){accounts
[num].AtotalInterestPaid
=accounts[num].ABalance*accounts[num
].ACurrentInterestRate
;returnaccounts[num]。AtotalInterestPaid;}帳戶(hù)存款publicvoidSaving(intnum,doublemoney){accounts[num].ABalance+=money;}帳戶(hù)提款publicvoidWithdarw(intnum,doublemoney){accounts[num]。ABalance-=money;}帳戶(hù)結(jié)算publicdoubletotalMoney(intnum){accounts[num]。ABalance+=accountsnum].AtotalInterestPaid;returnaccounts[num].ABalance;}統(tǒng)計(jì)銀行支付的總利息public
doubleBtotalPaid
(intno){for
(inti=0
;i<no;i++
)totalPaid+=InterestPaid(i
);return
totalPaid
;}}class
Program{static
voidMain(string[]
args){intno;//銀行管理的賬戶(hù)數(shù)int[]AN=newint[100];//賬戶(hù)的賬號(hào)int[]cir=newint[100];//賬戶(hù)的存款方式double[]Ba=newdouble[100];Console.WriteLine("—-—-—-——-—?dú)g迎進(jìn)入銀行模擬界面—--——--——”);Console。WriteLine("請(qǐng)輸入銀行管理的帳戶(hù)個(gè)數(shù)");no=Int16.Parse(Console。ReadLine());Console.WriteLine("請(qǐng)分別輸入每個(gè)帳戶(hù)的帳號(hào)”);for
(int
i=0
;
i<no;i++)AN
[i]=Int16。Parse(Console。ReadLine()Console.WriteLine(”請(qǐng)分別輸入每個(gè)帳戶(hù)的現(xiàn)有存款for(inti=0;i<no;i++)
);");Ba
[i
]=
Double.Parse(Console.ReadLine());Bankbank=newBank(no,AN,Ba);//bank對(duì)象Console。WriteLine("請(qǐng)分別選擇每個(gè)帳戶(hù)的存款方式:活期存款請(qǐng)輸入〈0〉,如期存款請(qǐng)輸入〈1〉”);for
(int
i=0;i
〈no;
i++){cir[i
]
=
Int32.Parse(Console.ReadLine()
);///////////////////////////////////////////////////////////////////////////bank
//bank.SetInterestRate。SetInterestRate///////////////////////////////////////////////////////////////////////
(i,cir[i(AN[i],
]);cir[i]
);}boolmoreAccount=true;//用于記錄可否有多個(gè)賬戶(hù)操作boolmorechoose=true;//用于記錄該帳戶(hù)可否執(zhí)行多個(gè)操作intchoose;//用于記錄賬戶(hù)選擇的操作while(moreAccount)//可否有多個(gè)賬戶(hù)操作{Console.WriteLine("請(qǐng)輸入要執(zhí)行操作的帳戶(hù)的帳號(hào)”);intnum=Int16。Parse(Console。ReadLine());while(morechoose)//可否對(duì)一個(gè)賬戶(hù)操作多次{Console.WriteLine(”請(qǐng)選綱要執(zhí)行的操作:<0>從該帳戶(hù)存款,〈1〉從該賬戶(hù)提款,〈2〉設(shè)置該帳戶(hù)的利率,〈3>顯示該帳戶(hù)的利息,〈4〉顯示該帳戶(hù)的結(jié)算總數(shù),〈5>統(tǒng)計(jì)銀行總支付的利息”);choose=Int16。Parse(Console.ReadLine());switch(choose){case0:Console.WriteLine(”請(qǐng)輸入要存入的錢(qián)數(shù)");doubleInMoney=double。Parse(Console。ReadLine());bank。Saving(num,InMoney);Console.WriteLine(”您的現(xiàn)有存款為:”);Console.WriteLine(Convert.ToString(bank。totalMoney(num)));Console.WriteLine(”請(qǐng)問(wèn)還要進(jìn)行其他操作嗎?<Y>是,〈N>否");///////////////////////////strings=Console.ReadLine();if(s==”y"||s=="Y”){morechoose=
true;}elsemorechoose=////////////////////////break;case1:
false;Console。WriteLine(”請(qǐng)輸入要取走的錢(qián)數(shù)”);doubleOutMoney=double.ParseConsole.ReadLine());bank。Withdarw(num,OutMoney);Console。WriteLine("您的現(xiàn)有存款為:”);Console。WriteLine(Convert。ToString(bank.totalMoney(num)));Console.WriteLine("請(qǐng)問(wèn)還要進(jìn)行其他操作嗎?Y>是,<N〉否");/////////////////////////////strings2=Console.ReadLine();if(s2==
”y”||s2==
"Y”){morechoose=
true;}elsemorechoose=
false
;//////////////////////break;case2:方式:<0〉活期存款,〈cir
Console。WriteLine("請(qǐng)輸入要更正成的存款1〉如期存款”);[num]=Int16。Parse(Console。ReadLine());bank
。SetInterestRate(num,cir
[num]);Console。WriteLine("請(qǐng)問(wèn)還要進(jìn)行其他操作嗎?〈Y>是,<N〉否”);//////////////////////////////////////strings3=Console.ReadLine();if(s3=="y"||s3=="Y”){morechoose=
true;}elsemorechoose=////////////////////////////////////
false;break;case3:Console.WriteLine("您的利息為:");Console。WriteLine(Convert。ToString(bank
。InterestPaid
(num)))
;Console.WriteLine(
"請(qǐng)問(wèn)還要進(jìn)行其他操作嗎?<Y〉是,〈
N>否”);/////////////////////////////////////////////////////////////strings4=Console。ReadLine()if(s4=="y"||s4==”Y")
;{morechoose=
true
;}elsemorechoose=
false
;///////////////////////////////////////////////////////break;case4:Console。WriteLineConsole。WriteLine
("您的總結(jié)算為:”);(Convert.ToString(bank.totalMoney(num
)));Console。WriteLine(”請(qǐng)問(wèn)還要進(jìn)行其他操作嗎?〈Y>是,〈N〉否”);//////////////////////////////////////////////////strings5=Console。ReadLine();if
(s5==
”y”||s5==
”Y”){morechoose=
true;}elsemorechoose=false;///////////////////////////////////////////break;case5:Console。WriteLine("銀行總支付的利息為:”);Console.WriteLine(Convert.ToString(bank.BtotalPaid(no)));Console。WriteLine(”請(qǐng)問(wèn)還要進(jìn)行其他操作嗎?<Y〉是,<N〉否");//morechoose=bool.Parse(Console.ReadLine());///////////////////////////////////////////////////////strings6=Console.ReadLine();if
(s6=="y"
||s6==
”Y”){morechoose=
true
;}elsemorechoose=
false
;////////////////////////////////////////////////////////break;default
:
break;}}Console.WriteLine
(”請(qǐng)問(wèn)還對(duì)其他賬戶(hù)操作嗎?
<Y>是,<N〉否”);//moreAccount=bool。Parse(Console.ReadLine(///////////////////////////////////////////stringval=Console。ReadLine();if(val==”y”||val==”Y")
));{moreA
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年供水設(shè)施建設(shè)協(xié)議書(shū)
- 2025年緊急出口門(mén)采購(gòu)合同
- 2025年午休時(shí)段兒童看護(hù)服務(wù)協(xié)議
- 兒童領(lǐng)養(yǎng)程序指導(dǎo)協(xié)議
- 2025年產(chǎn)品市場(chǎng)分隔協(xié)議范本
- 2025年防水建材項(xiàng)目立項(xiàng)申請(qǐng)報(bào)告模板
- 2025年公共場(chǎng)所消防設(shè)施供應(yīng)及維護(hù)合同
- 2025年同心同行策劃合作框架協(xié)議
- 2025年醫(yī)療用品分銷(xiāo)合作伙伴協(xié)議范例
- 2025年共同策劃長(zhǎng)遠(yuǎn)發(fā)展協(xié)同計(jì)劃協(xié)議書(shū)標(biāo)準(zhǔn)樣式
- 多元化評(píng)價(jià)體系構(gòu)建
- 部編版六年級(jí)下冊(cè)道德與法治全冊(cè)教案教學(xué)設(shè)計(jì)
- DBJ04∕T 290-2012 袖閥管注漿加固地基技術(shù)規(guī)程
- GB/T 17775-2024旅游景區(qū)質(zhì)量等級(jí)劃分
- 燈籠彩燈安裝合同范本
- 物流無(wú)人機(jī)垂直起降場(chǎng)選址與建設(shè)規(guī)范
- AQ/T 4131-2023 煙花爆竹重大危險(xiǎn)源辨識(shí)(正式版)
- 裝飾工程室內(nèi)拆除專(zhuān)項(xiàng)施工方案
- 員工服務(wù)意識(shí)提升提高服務(wù)意識(shí)培訓(xùn)課件
- 2024年河北省石家莊市裕華區(qū)中考二模語(yǔ)文試題
- 客服考試題目
評(píng)論
0/150
提交評(píng)論