正在加载图片...
PA13 PUBLIC ANSWERS TO EXERCISES E4.16 pp 135-136 Finding problems in requirements statements. a)Simple interest calculation program The requirements are not separated into individual points This is a handy utility 'is too informal It is not clear whether the fields are updated upon every keystroke, or whether the user has to hit ente or click on some button to cause an update of the fields It is not clear whether the monthly payments are at the start or end of each month(this effects the computation) (The computations themselves are well-known by accountants, so it is legitimate to exclude them There is no information about the platfom on which the program runs Maximum and minimum dollar amounts and interest rates that can be handled should be specified Precision of calculations should be specified What happens if the user enters invalid keystrokes? It would be desirable to descnbe the user interface in a little more detail E4. 17 p. 136 Rewriting requirements to remove defects a)Simple interest calculation program Functional Requirements When the system starts, a window appears, whose content and function is describe below The window has the title "Simple Interest Calculation,, as well as standard close and minimize icons The window has labels 'Principal: ,"Annual interest rate: , Interest paid at the end of each month The right edges of these are vertically aligned, and each is followed on the right by an input field The principal and interest fields are capable of accepting 10 characters of input, the interest rate field is capable of containing 8 characters The user may enter numeric values in each field; as each key is typed (including the delete key ), the other fields are updated instantly. An empty field is taken as having the value zero Editing the interest rate causes a change to the monthly payment Editing the monthly payment causes a change to the interest rate Editing the principal causes a change to the monthly payment The user may use the mouse to move the insertion point or select characters in any field, as in standard windows applications 999.99% to 999.99%/ The percent symbol is automatically added if the user does not specify it om The system can handle dollar amounts from.99 to 9999999.99, and interest rates fron All calculations are rounded to the nearest cent. Two decimal places are al ways shown in all three places Any edit to a field that would result in an invalid input, or a computed result that could not be displayed in the other fields, will not be accepted- the system will beep and display an error message at the bottom of the window describing the error. Error messages include The largest value accepted for <field> is xxx The smallest value accepted for <field> is xx Input must be numeric nput is only accepted to two decimal points A <field> input value of xxx would result in an invalid value for <field> Non-functional Requirements The program will run on all Microsoft Windows operating systems starting with Windows 95 and Windows NT4.0(on all CPUs of at least 33Mhz Response time will appear instantaneous to users E4.19 No public answer E4.20 No public answer C 2002 TIMOTHY C. LETHBRIDGE AND ROBERT LAGANIEREPA13 PUBLI C A NSW ERS T O EX E RCISE S © 2002 T IMO TH Y C. LE T HBRI D GEA N D RO BERT L AG AN I ÈRE E 4.16 pp. 135- 136 F inding proble ms in requirem e nts state m ents. a )*Sim pleint e re stcalc ulation pr ogr am • T her e quir e me nts a renot separ a te d into individual points • ‘ This is aha ndy utility’is too inf or ma l • I t is not c le arwhetherthe fie lds a reupda te d upon e ve r y ke ystroke, or w he the r theuserha s to hit ‘ ente r ’ or click on somebutton to c ause an upda te ofthe f ie lds. • I t is not c le ar whether the monthly pa yme nts a re a t the star t or e nd of e ac h month (this e f fe cts the c omputation). • ( The c omputations the mselves a r e we ll- known by a cc ounta nts, so it is le gitimate to exc ludethem) • T he reis no inf ormation a bout theplatfor m on whic h thepr ogr am r uns, • Maximum and minimum dolla ra mounts a nd inte re st ra tes that c a n beha ndled should bespec if ied. • Pre cision of ca lcula tions should bespec ified. • W ha t happe ns ifthe use r e nter s inva lid ke ystrokes? • I t would bedesira bleto descr ibethe use r inter fa c e in a little mor e detail. E 4.17 p. 136 R ewriting requirem e nts to re m ov e defec ts. a )*Sim pleint e re stcalc ulation pr ogr am • Functional Re quire me nts - W he n thesystem star ts, awindow appea rs, w hose conte nt and f unction is desc ribebe low . - T hew indowha s thetitle ‘ Simple Inter est Calc ulation’, as w e ll a s sta nda rd closea nd minimiz e icons in thetitle ba r . - T he window has la be ls ‘Principa l:’ , ‘ Annua l inter est r ate :’ , ‘ Inte r est paid a t thee nd ofe a ch month:’ . T her ight e dges ofthese a reve rtic a lly a ligne d, a nd ea c h is followe d on ther ight by an input f ie ld - T hepr incipal a nd inter est f ie lds a r e capableofa cc epting 10 c ha ra c te rs ofinput, the inter est r a tef ield is ca pableofc ontaining 8 c ha r ac te r s. - T heuserma y enternume ricvalues in e ac h f ie ld; a s e ac h key is type d ( including the deletekey) , the otherfields ar eupda te d insta ntly. An e mpty f ie ld is ta ke n a s ha ving theva lue z er o. - E diting theinte re st ra teca use s a c ha ngeto themonthly payment. - E diting themonthly payme nt ca use s ac ha ngeto theinte r est r ate - E diting theprincipa l c auses achange to the monthly pa yme nt - T he user may use the mouse to move the inse rtion point or se le c t cha ra cte rs in a ny field, as in sta nda rd W indow s a pplic ations. - T he system ca n handle dollar a mounts f rom - 999999.99 to 9999999.99, and inte re st ra te s f rom - 999.99% to 999.99% . T hepe rc ent symbol is a utoma tic ally adde d if theuserdoes not spe cify it. - A ll c a lc ula tions a re rounded to the ne ar e st c e nt. T wo de cima l pla c es a r e alw ays shown in a ll thr ee pla ce s. - A ny e dit to a f ield tha t w ould re sult in an inva lid input, or a c ompute d re sult that c ould not be displa ye d in the othe r fie lds, will not be ac c epte d – the syste m w ill bee p a nd displa y a n e rr or messa ge at the bottom of thew indowde sc r ibing theer ror . Er r orme ssage s inc lude : T hela rgest value ac c epte d f or<f ie ld>is xxx T hesmalle st va luea c ce pte d for< fie ld> is xxx I nput must benume ric I nput is only a c ce pte d to tw o dec ima l points A< fie ld> input va lueof xxx w ould r esult in a n invalid va luef or<f ie ld> • N on-f unc tiona l Requir ements - T he pr ogra m w ill r un on all Mic r osof t W indow s ope ra ting syste ms sta rting w ith W indow s 95 and W indow s NT4.0 ( on a ll CPU s ofat le ast 33Mhz ) . - Responsetimew ill a ppe arinsta ntane ous to use rs. E 4.18 No public answe r E 4.19 No public answe r E 4.20 No public answe r
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有