![白盒測試Java_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/16/18b91e3c-831c-4a18-9a6d-583dd12a3c52/18b91e3c-831c-4a18-9a6d-583dd12a3c521.gif)
![白盒測試Java_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/16/18b91e3c-831c-4a18-9a6d-583dd12a3c52/18b91e3c-831c-4a18-9a6d-583dd12a3c522.gif)
![白盒測試Java_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/16/18b91e3c-831c-4a18-9a6d-583dd12a3c52/18b91e3c-831c-4a18-9a6d-583dd12a3c523.gif)
![白盒測試Java_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/16/18b91e3c-831c-4a18-9a6d-583dd12a3c52/18b91e3c-831c-4a18-9a6d-583dd12a3c524.gif)
![白盒測試Java_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/16/18b91e3c-831c-4a18-9a6d-583dd12a3c52/18b91e3c-831c-4a18-9a6d-583dd12a3c525.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、計算機科學與技術(shù)系 實 驗 報 告專業(yè)名稱 軟件工程 課程名稱 軟件測試 項目名稱 白盒測試之賦稅管理系統(tǒng) 班 級 12級軟件工程 學 號 1204091034 姓 名 常成 同組人員 實驗日期 2014/10/13 一、實驗內(nèi)容:利用白盒測試之賦稅管理系統(tǒng)練習基本路徑測試方法。二、實驗目的與要求:實驗目的:基本路徑測試方法練習收入Income和供養(yǎng)人數(shù)nDependance來計算賦稅金額的程序。程序輸入是Income和nDependance,程序輸出是:總稅金TaxTotal應繳所得稅計算公式:TaxSubtotal收入(income)稅率計算公式<100000.02*income10
2、000£income<50000200+0.03*(income-10000)³500001400+0.04*(income-50000)免稅部分:exemption = 人數(shù)*50;實繳所得稅: TaxTotal = TaxSubtotal exemption實驗要求:使用java語言實現(xiàn)。畫出該程序的控制流圖計算圈復雜度獲取基本路徑設(shè)計測試用例,使得每條基本路徑都要覆蓋到。三、實驗步驟1、 算法實現(xiàn)(附上源代碼)程序Java代碼:package P.test;import java.util.Scanner;public class TexTotal privat
3、e double totals;private double income;private int per;public double gettotals()return totals;public void setShuru(double income,int per)this.income=income;this.per=per;public boolean getShuru() try Scanner in = new Scanner(System.in);System.out.println("請輸入你的工資和家庭人數(shù)(以空格隔開):");this.income =
4、 in.nextInt();this.per = in.nextInt(); catch (Exception e) System.out.println("請輸入正確的工資數(shù)目!");System.out.println("錯誤類型:" + e);return false;return true;public void Income()if(this.income<=0|this.per<=0)System.out.println("請輸入正確的家庭人數(shù)和收入!");else if(this.income < 10
5、000)this.totals=this.income*0.02-this.per*50;else if(this.income>=10000 && this.income<50000)this.totals=200+(this.income-10000)*0.03-this.per*50;elsethis.totals=1400+(this.income-50000)*0.04-this.per*50;if(this.totals<0)this.totals=0;public void Prints() System.out.println("需要
6、繳納的稅為:"+this.totals);public static void main(String args)TexTotal d=new TexTotal();if(d.getShuru()d.Income();d.Prints();測試代碼:package P.test;import static org.junit.Assert.*;import junit.framework.Assert;import org.junit.After;import org.junit.Before;import org.junit.Test;public class TexTotalTe
7、st TexTotal s=new TexTotal();Beforepublic void setUp() throws Exception Afterpublic void tearDown() throws Exception Testpublic void testGetShuru1() s.setShuru(9994,5);s.Income();Assert.assertEquals(0.0,s.gettotals();Testpublic void testGetShuru2() s.setShuru(10023,3);s.Income();Assert.assertEquals(
8、50.69,s.gettotals();Testpublic void testGetShuru3() s.setShuru(59232,4);s.Income();Assert.assertEquals(1569.28,s.gettotals();Testpublic void testGetShuru4() s.setShuru(500,0);s.Income();Assert.assertEquals(0.0,s.gettotals();Testpublic void testGetShuru5() s.setShuru(-50000,4);s.Income();Assert.assertEquals(0.0,s.gettotals();2、控制流圖293031303132343336353738394140423、 測試用例設(shè)計編號輸入數(shù)據(jù)預期輸出1供養(yǎng)人數(shù)5收入9994總稅金0.02供養(yǎng)人數(shù)3收入10023總稅金50.693供養(yǎng)人數(shù)4收入59232總稅金1569.284供養(yǎng)人數(shù)0收入500總稅金0.0請輸入正確的家庭人數(shù)和收入!5供養(yǎng)人數(shù)4收入-50000總稅金0.0請輸入正確的家庭人數(shù)和收入!3 測試數(shù)據(jù)與實驗結(jié)果分析測試均順利通過。路徑覆蓋率為100%。四、實驗小結(jié):(實驗過程中
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2030年數(shù)字式功率儀表項目投資價值分析報告
- 2025年中國氡子體檢測儀市場調(diào)查研究報告
- 2025年中國固體藥用瓶市場調(diào)查研究報告
- 2025年高強細碎除石對滾機項目可行性研究報告
- 二零二五年度環(huán)保產(chǎn)品宣傳推廣合同
- 2025年中介機構(gòu)房產(chǎn)融資合同
- 2025年企業(yè)間勞動合同模板范文
- 二零二五年度離婚財產(chǎn)分割及債務處理專業(yè)合同范本2篇
- 2025年中國銀行融資租賃合同
- 2025年個人教育貸款合同版
- 睡眠障礙護理查房課件
- 應急物資的采購、存儲與調(diào)配
- 超融合架構(gòu)與傳統(tǒng)架構(gòu)對比解析方案
- 少兒美術(shù)課件- 9-12歲 素描班《場景素描》
- 剪映:手機短視頻制作-配套課件
- 金融工程.鄭振龍(全套課件560P)
- 血液透析的醫(yī)療質(zhì)量管理與持續(xù)改進
- 橋式起重機日常檢查保養(yǎng)記錄表
- 五年級小數(shù)乘法豎式計算300道(可直接打印)
- 英語演講技巧和欣賞課件
- 物流托運單模板
評論
0/150
提交評論