东软实例介绍PPT优秀课件

上传人:工**** 文档编号:567553090 上传时间:2024-07-21 格式:PPT 页数:26 大小:680.50KB
返回 下载 相关 举报
东软实例介绍PPT优秀课件_第1页
第1页 / 共26页
东软实例介绍PPT优秀课件_第2页
第2页 / 共26页
东软实例介绍PPT优秀课件_第3页
第3页 / 共26页
东软实例介绍PPT优秀课件_第4页
第4页 / 共26页
东软实例介绍PPT优秀课件_第5页
第5页 / 共26页
点击查看更多>>
资源描述

《东软实例介绍PPT优秀课件》由会员分享,可在线阅读,更多相关《东软实例介绍PPT优秀课件(26页珍藏版)》请在金锄头文库上搜索。

1、IT Education & Training实例介绍软件外包教研室IT Education & Training第2章 实例介绍2.1三角形问题2.2NextDate问题2.3佣金问题2.4简单ATM系统2.5货币转换器2IT Education & Training2.1 三角形问题 三角形问题是在软件测试文献中使用最广的一个例子,这个例子经久不衰的原因之一是,它包含了清晰而又复杂的逻辑。它还是削弱客户、开发人员和测试人员沟通的不完整定义的典型例子。三角形问题之所以复杂,是因为输入与正确输出之间的关系复杂。3IT Education & Training2.1.1 三角形问题陈述三角形问题

2、陈述简单版本简单版本:三角形问题接受三个整数a、b和c作为输入,用作三角形的边。程序的输出是由这三条边确定的三角形类型:等边三角形、等腰三角形、不等边三角形或非三角形。有时这个问题被扩展为将直角三角形作为第五类,在有些练习中会使用这种扩展。改进版本改进版本:三角形问题接受三个整数a、b和c作为输入,用作三角形的边。整数a、b和c必须满足以下条件:c1:1=a=200 c4: ab+cc2: 1=b=200 c5: ba+cc3: 1=c=200 c6: ca+b 4IT Education & Training续 程序的输出是由这三条边确定的三角形类型:等边三角形、等腰三角形、不等边三角形或非

3、三角形。如果输入值没有满足这些条件中的任何一个,则程序会通过输出消息来进行通知,例如,“b的取值不在允许范围内”,若c1、c2、c3满足,则给出以下四种相互排斥输出的一个:1.如果三条边相等,则程序的输出是等边三角形。2.如果两条边相等,则程序的输出是等腰三角形。3.如果没有两条边相等,则程序的输出是不等边三角形。4.如果c4、c5和c6中有一个条件不满足,则程序的输出是非三角形。5IT Education & Training2.1.2三角形问题实现以下是三角形问题的数据流图描述。可以把这个程序实现为一个主程序和三个简单的过程。在后续章节里我们还要用到这个例子,现在将它的实现用伪代码表示。6

4、IT Education & Training三角形程序实现的数据流图7IT Education & Training三角形问题实现的伪代码Program triangle2 version of simpleDim a,b,c As IntegerDim IsATriangle As BooleanStep1: Get InputOutput(“Enter 3 integers which are sides of a triangle”)Input(a,b,c)Output(“Side A is ”,a)Output(“Side B is ”,b)Output(“Side C is ”,c

5、)Step 2:Is A Triangle?If (ab+c) AND(ba+c)AND(ca+b)Then IsATriangle =TrueElse IsATriangle =FalseEndIfstep3:Determine Triangle TypeIf IsATrangle Then if(a=b)AND (b=c) Then Output(“Equilateral”) Else If(ab)AND(ac)AND(bc) Then Output(“Scalence”) Else Output(“Isosecles”) EndIf EndIf Else Output(“NOT a Tr

6、iangle”)EndIfEnd triangle28IT Education & Training三角形问题实现的伪代码Program triangle3 improved versionDim a,b,c As IntegerDim IsATriangle As BooleanStep1: Get InputDoOutput(“Enter 3 integers which are sides of a triangle”)Input(a,b,c)c1=(1=200)c2=(1=200)c3=(1=200)If NOT(c1) Then Output(“Value of a is not i

7、n the range of permitted values”)EndIfIf NOT(c2) Then Output(“Value of b is not in the range of permitted values”)EndIfIf NOT(c3) Then Output(“Value of c is not in the range of permitted values”)EndIfUntil c1 AND c2 AND c3Output(“Side A is ”,a)Output(“Side B is ”,b)Output(“Side C is ”,c) Step2 Step3

8、End triangle39IT Education & Training2.2 NextDate函数输入变量之间的逻辑比较复杂有两种复杂性来源:输入域和闰年规则80%活动出现在20%的空间10IT Education & Training2.2.1 NextDate 问题陈述NextDate是一个有三个变量(月份、日期和年)的函数。函数返回输入日期后面的那个日期。变量月份、日期和年都是整数值,并满足以下条件:c1:1=月份=12c2:1=日期=31c3:1812=年=2012 我们的处理要包括对月份、日期和年的无效输入值的响应处理,还要对无效逻辑处理,例如任意年的4月31日。11IT Edu

9、cation & Training2.2.2 NextDate 的伪代码实现Program NextDate1 Simple versionDim tomorrowDay,tomorrowMonth,tomorrowYear As IntegerDim day,month,year As IntegerOutput(“Enter todays date in the form MM DD YYYY”)Input(month,day,year)Case month OfCase 1:month Is1,3,5,7,8,or 10:31 day months (excpet 12)If day31

10、 then tomorrowDay=day+1 else tomorrowDay=1 tomorrowMonth=month+1EndIfCase 2:month Is 4,6,9 or 11 30day monthIf day30 then tomorrowDay=day+1 else tomorrowDay=1 tomorrowMonth=month+1EndIf12IT Education & Training续NextDates simple versionCase 3:month Is 12:If day31 then tomorrowDay=day+1 else tomorrowD

11、ay=1 tomorrowMonth=1 If year=2012 then Output(“2012 is over”) else tomorrowYear=year+1 EndIfEndIfCase 4:month Is 2:If day45000.0) then commission=0.04*20000.0 commission= commission+0.01*25000.0 commission= commission+0.005*(sales-45000.0) else If(sales20000) then commission=0.04* commission commiss

12、ion= commission+0.01*(sales-20000) else commission=0.04*sales EndIfEndIfOutput(“Commission is ”,commission,”元”)EndCommission19IT Education & Training2.4 SATM系统为了方便同学们了解集成测试和系统测试,我们介绍一个简单的自动柜员机系统,包含各种功能和交互,是一个典型的客户/服务系统的客户端。20IT Education & Training2.4.1 SATM的问题描述SATM客户可以选择三种交易中的任意一种:存款、取款和查询余额。这些交易可

13、以在信用帐户和储蓄帐户上完成。21IT Education & Training2.4.1 SATM的问题描述22IT Education & Training2.4.2 SATM问题分析有大量的信息隐藏在刚刚给出的系统描述中。例如,100元的整数倍,这种文字描述可能比实际问题中更加精确。SATM-简单ATM透支额度?放入多少现金?何种现金?23IT Education & Training2.5 货币转换器货币转换器是另一种事件驱动的程序。它强调图形用户界面关联的代码。这个例子很好的说明了UML描述和一个面向对象的实现。24IT Education & TrainingQ & A25个人观点供参考,欢迎讨论

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号