![C#課程設計—自動取款機模擬軟件設計_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-4/24/a7a64254-6be1-4e74-be46-78f070574b77/a7a64254-6be1-4e74-be46-78f070574b771.gif)
![C#課程設計—自動取款機模擬軟件設計_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-4/24/a7a64254-6be1-4e74-be46-78f070574b77/a7a64254-6be1-4e74-be46-78f070574b772.gif)
![C#課程設計—自動取款機模擬軟件設計_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-4/24/a7a64254-6be1-4e74-be46-78f070574b77/a7a64254-6be1-4e74-be46-78f070574b773.gif)
![C#課程設計—自動取款機模擬軟件設計_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-4/24/a7a64254-6be1-4e74-be46-78f070574b77/a7a64254-6be1-4e74-be46-78f070574b774.gif)
![C#課程設計—自動取款機模擬軟件設計_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-4/24/a7a64254-6be1-4e74-be46-78f070574b77/a7a64254-6be1-4e74-be46-78f070574b775.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、*學院課程設計說明書(2012/2013學年第一學期)課程名稱:軟件程序設計題目:自動提款機模擬軟件專業(yè)班級:學生姓名:放羊娃學號:指導教師:設計周數(shù):2周設計成績:2013年1月18日1、課程設計目的2、系統(tǒng)的分析與設計2.1 需求分析2.1.1 課設任務2.1.2 課設要求2.2 系統(tǒng)的設計2.2.1 數(shù)據(jù)庫的分析與設計2.2.2 邏輯層次的設計2.3 程序設計2.3.1 程序流程圖2.3.2 系統(tǒng)實施3、課程設計總結或結論4、參考文獻1、課程設計目的通過c#課程設計,使學生能將學到的面向對象的程序設計思想應用到具體的工作和學習中,加深對類與對象的理解。進一步鞏固所學的c#及數(shù)據(jù)庫的相關理
2、論知識,提高分析和解決實際問題的能力。2、系統(tǒng)的分析與設計ATM機很方便,沒有休息日,上班時間也長,除了換錢的半個小時左右,可以通宵達旦的工作。幾乎相當于3個銀行工作人員倒班干活。大大提高了銀行效率,節(jié)約了人力和儲戶的時間。缺點是,有些人不會使用,會產(chǎn)生吞卡等現(xiàn)象,給部分人帶來麻煩。但隨著人們素質放入提高,這些缺點的影響已經(jīng)越來越小了。2.1 需求分析2.1.1 課設任務(1)根據(jù)技術要求和現(xiàn)有開發(fā)環(huán)境,分析題目。(2)選定設計方案,包括,軟件功能結構,畫出軟件框架結構圖,關鍵程序流程圖,數(shù)據(jù)庫中表的結構設計等。(4)使用C#語言和.net框架,并結合數(shù)據(jù)庫,實現(xiàn)軟件。(5)調試,修改并完善程
3、序。2.1.2 課設要求(1)仿某銀行的運行界面。(2)用戶憑正確的卡號和密碼進入系統(tǒng)(若輸入密碼錯誤次數(shù)達到上限,鎖定賬號)(3)取款、交費、轉賬、查詢余額、修改密碼等功能。(4)其他功能(包括開戶,存款,銷戶等功能)。2.2 系統(tǒng)的設計2.2.1 :用戶通過鍵盤進行輸入。2.2.2 :可使用戶在無任何經(jīng)驗的情況下進行操作ATM自助式服務。2.2.3 方面:取款、查詢余額、修改密碼、記錄查詢、交費、轉賬。2.2.4 數(shù)據(jù)庫的分析與設計由自動提款機模擬軟件系統(tǒng)的需求分析我們可以知道,本系統(tǒng)應為windows應用窗體的設計,據(jù)提供的實驗環(huán)境及以前所學的理論知識,采用SQL數(shù)據(jù)庫,根據(jù)自動提款機模
4、擬軟件的功能要求,在Databasel數(shù)據(jù)庫中建立兩張表來存儲信息,分別為userinfo和recordinfo。userinfo表中用來存儲用戶的卡號,密碼,用戶名,余額及用于卡號鎖定的字段表2-1用戶基本信息表(userinfo)列名數(shù)據(jù)類型長度允許為空是否為主鍵說明Yonghunvarchar20否是mimanvarchar20否否密碼yuemoney是否余額recordinfo表中用于存儲用戶的卡號,用戶名,存取結余,主要用于數(shù)據(jù)庫的更新操作。表2-2用戶操作信息表(recordinfo)列名數(shù)據(jù)類型長度允許為空是否為主鍵說明yonghunvarchar19否是卡號標識shijiand
5、atetime否否操作時間leixingnvarchar20是否操作類型kayuedecimal(18,0)是否交易金額2.2.5 邏輯層次的設計本次課設的自動提款機模擬軟件系統(tǒng)可以使用戶進行登錄、取款、轉賬、查詢余額、修改密碼、記錄查詢和交費等基本業(yè)務。ATM自動提款機結構基本框圖圖2-1ATM系統(tǒng)的基本框圖2.3 程序設計用戶進入后,點擊用戶登錄進入登陸界面,在登錄窗口中輸入卡號和密碼,判斷卡號與密碼是否正確,若卡號與密碼正確則進入用戶操作界面,并根據(jù)用戶的相關操作給用戶提供相應的服務。若卡號與密碼不正確,彈出對話框提示用戶確認卡號和密碼錯誤后重新輸入,并對輸入錯誤次數(shù)進行計數(shù),若輸入密碼
6、錯誤次數(shù)大于3次,則鎖定該帳號。2.3.1 程序流程圖軟件設計程序流程圖如圖2-2所示:開始業(yè)勞選擇輸入密碼業(yè)務處理鎖定卡號結束圖2-2程序流程圖2.3.2 系統(tǒng)實施本系統(tǒng)主要通過運用C刷Windows窗體的設計進行開發(fā)和實施,主要通過如下幾個功能模塊來完成系統(tǒng)的具體的實施過程:(1)用戶登陸窗體:通過登陸界面可以進行用戶的登陸過程,進而實現(xiàn)相應的用戶操2-3所示:作。即當用戶名與密碼都正確時用戶就可以登陸進行所需的操作,其界面如圖圖2-3登陸界面代碼如下:namespaceWindowasd(publicpartialclassForml:Form(publicForm1()(Initial
7、izeComponent();intc;publicstaticstringlockID;privatevoidbutton4_Click(objectsender,EventArgse)(maskedTextBox1.Text=""privatevoidbutton3_Click(objectsender,EventArgse)(if(maskedTextBox2.Text.Trim()!="")(SqlConnectionconn=newSqlConnection("DataSource=.SQLEXPRESS;AttachDbFilena
8、me=|DataDirectory|Database1.mdf;IntegratedSecurity=True;ConnectTimeout=30;UserInstance=True");conn.Open();stringssql="select*fromuserinfowhereyonghu='"+maskedTextBox2.Text.Trim()+""';SqlCommandccmd=newSqlCommand(ssql,conn);SqlDataReaderdr1=ccmd.ExecuteReader();if(dr1
9、.Read()dr1.Close();lockID=maskedTextBox2.Text.Trim().ToString();stringisornot="selectmimafromuserinfowhereyonghu='"+maskedTextBox2.Text.Trim().ToString()+"'"SqlCommandcmd0=newSqlCommand(isornot,conn);SqlDataReaderdrr=cmd0.ExecuteReader();if(drr.Read()&&drr"mi
10、ma".ToString()="1")MessageBox.Show("您的帳號已被鎖定,請與銀行管理員聯(lián)系!");drr.Close();elsedrr.Close();stringsql="select*fromuserinfowhereyonghu='"+maskedTextBox2.Text.Trim().ToString()+"'andmima='"+maskedTextBox1.Text.Trim().ToString()+""'SqlCom
11、mandcmd=newSqlCommand(sql,conn);SqlDataReaderdr=cmd.ExecuteReader();if(dr.Read()maskedTextBox2.Text=dr"yonghu".ToString();Form2frm=newForm2();frm.Show();this.Hide();elseif(this.c+<3)MessageBox.Show("您密碼不正確,請重新輸入!","提示!MessageBoxButtons.OK,MessageBoxIcon.Error);maskedTextB
12、ox2.Text=""maskedTextBoxl.Text="")else(dr.Close();stringsqll="updateuserinfosetmima='1'whereyonghu='"+maskedTextBox2.Text.Trim()+""'SqlCommandcmd1=newSqlCommand(sql1,conn);if(cmd1.ExecuteNonQuery()=1)(MessageBox.Show("您已經(jīng)輸入超過三次,該帳號將被鎖定,請聯(lián)系
13、銀行管理員!","錯誤",MessageBoxButtons.OK,MessageBoxIcon.Error);)else(MessageBox.Show("賬號不正確");)conn.Close();)else(MessageBox.Show("請輸入卡號與密碼!","警告!",MessageBoxButtons.OK,MessageBoxIcon.Warning);maskedTextBox2.Text=""maskedTextBox1.Text="")priv
14、atevoidbutton1_Click(objectsender,EventArgse)(Application.Exit();)privatevoidForm1_Load(objectsender,EventArgse)()2-4所示:(2)ATM自動取款機服務界面,主菜單可以實現(xiàn)以下服務,其界面如圖圖2-4主菜單代碼如下:namespaceWindowasd(publicpartialclassForm2:Form(publicForm2()(InitializeComponent();)privatevoidbutton2_Click(objectsender,EventArgse)(
15、Form3frm=newForm3();frm.Show();this.Hide();)privatevoidbutton5_Click(objectsender,EventArgse)(Form4frm=newForm4();frm.Show();this.Hide();privatevoidbutton3_Click(objectsender,EventArgse)(Form5frm=newForm5();frm.Show();this.Hide();)privatevoidbutton4_Click(objectsender,EventArgse)(Form6frm=newForm6()
16、;frm.Show();this.Hide();)privatevoidbutton7_Click(objectsender,EventArgse)(Form1frm=newForm1();frm.Show();this.Hide();/Application.Exit();)privatevoidbutton1_Click(objectsender,EventArgse)(Form7frm=newForm7();frm.Show();this.Hide();)privatevoidbutton6_Click(objectsender,EventArgse)(Form8frm=newForm8
17、();frm.Show();this.Hide();)privatevoidForm2_Load(objectsender,EventArgse)(3)取款窗體:通過該界面用戶可以從自己的賬戶中進行取款操作,但是取款的金額必須在規(guī)定范圍內且為100元的整數(shù)倍,否則無法進行操作,當用戶余額不足以提取時提示余額不足,其界面如圖2-5所示:圖2-5:取款界面代碼如下:namespaceWindowasd(publicpartialclassForm3:Form(publicForm3()(InitializeComponent();)privatevoidbutton3_Click(objectse
18、nder,EventArgse)(Form2frm=newForm2();frm.Show();this.Hide();)privatevoidbutton2_Click(objectsender,EventArgse)(maskedTextBoxl.Text=""SqlConnectionconnprivatevoidbutton1_Click(objectsender,EventArgse)(newSqlConnection("DataSource=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database1.md
19、f;IntegratedSecurity=True;ConnectTimeout=30;UserInstance=True");conn.Open();stringsql="SELECT*FROMuserinfoWHEREyonghu=""+Form1.lockID+"”'SqlCommandcmd=newSqlCommand(sql,conn);SqlDataReaderdr=cmd.ExecuteReader();dr.Read();decimaljine=Convert.ToDecimal(dr2);decimalsqje=Con
20、vert.ToDecimal(maskedTextBoxl.Text);decimalchange=sqje;stringpresentname=Convert.ToString(dr1);stringcardid=""'+Form1.lockID+""';stringtime=Convert.ToString(DateTime.Now);dr.Close();if(jine>sqje)(if(sqje%100=0)(MessageBox.Show("請在秒內取款11);decimalleftmoney=jine-sqje
21、;stringssql="Updateuserinfosetyue='"+leftmoney+"'whereyonghu='"+Form1.lockID+""'SqlCommandccmd=newSqlCommand(ssql,conn);MessageBox.Show("取款成功");inti=ccmd.ExecuteNonQuery();if(i=1)(maskedTextBox1.Text="")else(MessageBox.Show("本機只提
22、供以百元為單位的金額,請正確輸入金額!");maskedTextBox1.Text="")else(MessageBox.Show("您的余額不足!");maskedTextBoxl.Text="")conn.Close();)privatevoidForm3_Load(objectsender,EventArgse)(4)存款窗體:通過該界面用戶可以從自己的賬戶中進行取存款操作,但是存款的金額必須在規(guī)定范圍內且為100元的整數(shù)倍,否則無法進行操作,其界面如圖2-6所示:返回修改確認圖2-6存款界面代碼如下:namespac
23、eWindowasdpublicpartialclassForm4:FormpublicForm4()InitializeComponent();)privatevoidbutton3_Click(objectsender,EventArgse)maskedTextBox1.Text=""privatevoidbutton2_Click(objectsender,EventArgse)(Form2frm=newForm2();frm.Show();this.Hide();privatevoidbutton1_Click(objectsender,EventArgse)(Sq
24、lConnectionconn=newSqlConnection("DataSource=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database1.mdf;IntegratedSecurity=True;ConnectTimeout=30;Use門nstance=True");conn.Open();stringsql="SELECT*FROMuserinfoWHEREyonghu=""+Forml.lockID+""';SqlCommandcmd=newSqlCom
25、mand(sql,conn);SqlDataReaderdr=cmd.ExecuteReader();dr.Read();decimaljine=Convert.ToDecimal(dr2);decimalsqje=Convert.ToDecimal(maskedTextBoxl.Text);stringpresentname=Convert.ToString(dr1);stringcardid="'"+Forml.lockID+"'"decimalchange=sqje;stringtime=Convert.ToString(DateT
26、ime.Now);dr.Close();if(sqje%100=0)(MessageBox.Show("操作正在,請稍侯11);decimalleftmoney=jine+sqje;stringssql="Updateuserinfosetyue='"+leftmoney+"'whereyonghu='"+Forml.lockID+""';SqlCommandccmd=newSqlCommand(ssql,conn);MessageBox.Show("存款成功!");mas
27、kedTextBoxl.Text=""inti=ccmd.ExecuteNonQuery();if(i=1)(maskedTextBoxl.Text=""else(MessageBox.Show("操作失敗,請重試!","提示:",MessageBoxButtons.OK,MessageBoxIcon.Error);else(MessageBox.Show("本機只提供以百元為單位的金額,請正確輸入金額!");)privatevoidForm4_Load(objectsender,EventAr
28、gse)()(6)轉賬窗體:通過該界面用戶可以給除自己外的其他賬戶進行轉賬,其界面如圖2-7所示:圖2-7轉賬窗口代碼如下:namespaceWindowasd(publicpartialclassForm5:Form(publicForm5()(InitializeComponent();)privatevoidbutton3_Click(objectsender,EventArgse)(SqlConnectionconnnewSqlConnection("DataSource=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database
29、1.mdf;IntegratedSecurity=True;ConnectTimeout=30;UserInstance=True");conn.Open();stringsql="SELECT*FROMuserinfoWHEREyonghu=""+Forml.lockID+"”'SqlCommandcmd=newSqlCommand(sql,conn);SqlDataReaderdr=cmd.ExecuteReader();dr.Read();decimaljine=Convert.ToDecimal(dr2);stringwo=Co
30、nvert.ToString(dr1);decimalsqje=Convert.ToDecimal(maskedTextBoxl.Text);dr.Close();if(jine>sqje)(MessageBox.Show("正在操作,請稍侯11);decimalleftmoney=jine-sqje;stringssql="Updateuserinfosetyue='"+leftmoney+"'whereyonghu='"+Forml.lockID+"”'SqlCommandccmd=newSq
31、lCommand(ssql,conn);inti=ccmd.ExecuteNonQuery();if(i=1)(stringsqql="select*fromuserinfowhereyonghu='"+maskedTextBox2.Text.Trim()+"'"SqlCommandcmdd=newSqlCommand(sqql,conn);SqlDataReaderdrr=cmdd.ExecuteReader();if(drr.Read()(decimalje=Convert.ToDecimal(drr2);stringpresentn
32、ame=wo;stringcardid=""'+Forml.lockID+"”'decimalchange=sqje;stringtime=Convert.ToString(DateTime.Now);je=je+sqje;drr.Close();stringsqqll="Updateuserinfosetyue='"+je+"'whereyonghu='"+maskedTextBox2.Text.Trim()+""'SqlCommandcmmdd=newS
33、qlCommand(sqql1,conn);intn=cmmdd.ExecuteNonQuery();if(n=1)(MessageBox.Show("轉賬成功!");maskedTextBox2.Text=""maskedTextBoxl.Text="")else(MessageBox.Show("轉賬失??!");maskedTextBox2.Text=""maskedTextBox1.Text="")else(MessageBox.Show("操作失敗,請重試!
34、","提示:",MessageBoxButtons.OK,MessageBoxIcon.Error);)else()else(MessageBox.Show("您的余額不足,請重新輸入金額!");maskedTextBox1.Text="")privatevoidbutton1_Click(objectsender,EventArgse)(maskedTextBox1.Text="")privatevoidbutton2_Click(objectsender,EventArgse)(Form2frm=ne
35、wForm2();frm.Show();this.Hide();)privatevoidForm5_Load(objectsender,EventArgse)()privatevoidlabel2_Click(objectsender,EventArgse)()2-8所示:(7)交費窗體:通過該界面用戶可以自行交費,其界面如圖圖2-8交費窗口代碼如下:namespaceWindowasd(publicpartialclassForm6:Form(publicForm6()(InitializeComponent();privatevoidmaskedTextBox1_MaskInputReje
36、cted(objectsender,MaskInputRejectedEventArgse)(privatevoidbutton1_Click(objectsender,EventArgse)(Form2frm=newForm2();frm.Show();this.Hide();privatevoidbutton2_Click(objectsender,EventArgse)(maskedTextBox1.Text="")privatevoidbutton3_Click(objectsender,EventArgse)(SqlConnectionconn=newSqlCon
37、nection("DataSource=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database1.mdf;IntegratedSecurity=True;ConnectTimeout=30;UserInstance=True");conn.Open();stringsql="SELECT*FROMuserinfoWHEREyonghu=""+Forml.lockID+""';SqlCommandcmd=newSqlCommand(sql,conn);SqlDataRe
38、aderdr=cmd.ExecuteReader();dr.Read();decimaljine=Convert.ToDecimal(dr2);decimalsqje=Convert.ToDecimal(maskedTextBoxl.Text);stringpresentname=Convert.ToString(dr1);stringcardid="'"+Forml.lockID+"'"decimalchange=sqje;stringtime=Convert.ToString(DateTime.Now);dr.Close();if(j
39、ine>sqje)(MessageBox.Show("操作正在,請稍侯11);decimalleftmoney=jine-sqje;stringssql="Updateuserinfosetyue='"+leftmoney+"'whereyonghu='"+Forml.lockID+""';SqlCommandccmd=newSqlCommand(ssql,conn);MessageBox.Show("交費成功!");maskedTextBoxl.Text="
40、;"inti=ccmd.ExecuteNonQuery();if(i=1)(maskedTextBoxl.Text="")else(MessageBox.Show("操作失敗,請重試!","提示:",MessageBoxButtons.OK,MessageBoxIcon.Error);)else(MessageBox.Show("您的余額不足!");maskedTextBoxl.Text=""privatevoidForm6_Load(objectsender,EventArgse)(
41、9)修改密碼窗體:通過該界面用戶可以給自己的賬戶進行修改密碼的操作,兩次輸入的新密碼一樣將修改成功,否則將失敗,其界面如圖2-9所示:圖2-9修改密碼代碼如下:namespaceWindowasd(publicpartialclassForm7:Form(publicForm7()(InitializeComponent();privatevoidbutton1_Click(objectsender,EventArgse)(Form2frm=newForm2();frm.Show();this.Hide();privatevoidbutton3_Click(objectsender,Event
42、Argse)(SqlConnection("DataSecurity=True;Connect"'whereyonghu='"+SqlConnectionconn=newSource=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database1.mdf;IntegratedTimeout=30;UserInstance=True");conn.Open();stringpassword1=maskedTextBox2.Text.Trim().ToString();stringpassword2
43、=maskedTextBox3.Text.Trim().ToString();if(password1=password2)(stringsqql="Updateuserinfosetmima='"+password1+Form1.lockID+"”'SqlCommandcmdd=newSqlCommand(sqql,conn);inti=cmdd.ExecuteNonQuery();if(i=1)(MessageBox.Show("密碼修改成功!");maskedTextBox2.Text=""maskedTextBox3.Text=""else(MessageBox.Show("密碼修改失敗,請重試!");else(MessageBox.Show("兩次輸入密碼不一至!");maskedTextBox3.Text="
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 勞務合同范例粉水
- 2025年公共藝術設計市場調研報告
- 公路護欄工程合同范例
- 學校保安聘任合同范本
- 出售魚苗批發(fā)合同范本
- 公司賣舊車合同范例
- 2025年度燃氣設施建設與運營管理合同范本
- 2025年度建筑施工單位臨時用工勞務派遣與職業(yè)健康合同
- 餐飲服務合同范本
- 船舶設備零部件行業(yè)深度研究報告
- 二零二五年度集團公司內部項目專項借款合同范本3篇
- 低空飛行旅游觀光項目可行性實施報告
- 2024年版:煤礦用壓力罐設計與安裝合同
- 2024年貴州云巖區(qū)總工會招聘工會社會工作者筆試真題
- 《算法定價壟斷屬性問題研究的國內外文獻綜述》4200字
- 2024年04月浙江義烏農(nóng)商銀行春季招考筆試歷年參考題庫附帶答案詳解
- 涉密計算機保密培訓
- 掛靠免責協(xié)議書范本
- 2024年浙江省五校聯(lián)盟高考地理聯(lián)考試卷(3月份)
- 在線心理健康咨詢行業(yè)現(xiàn)狀分析及未來三至五年行業(yè)發(fā)展報告
- 電動三輪車購銷合同
評論
0/150
提交評論