Ask a question to Desklib · AI bot


2. Specification. A secure research facility has hired

15 Pages3388 Words174 Views

Added on  2019-09-21

BookmarkShareRelated Documents
2.SpecificationAsecureresearchfacilityhashired you todevelopanewsystemforthe liftsof itssecurebuilding.Thesystemneedsto know whereeveryoneinthebuildingisat everymoment. Tousethelifts,apersonmust be added to thesystemandgivenanIDcard. ThisID card mustbeswipedwhenmakinga trip on the lift so thattheliftcantrackthemovement of that person.Thebuildinghas6floorsand 3 lifts. Each liftservicesadifferentrange of levels: Lift 1serviceslevels16,Lift2 serviceslevels26 and Lift 3 serviceslevels25. The buildingentranceisonlevel2andthe initial resting positionsof all 3 liftsislevel 2.Whenapersonregistersforan ID card, the systemrecordstheir initial level as2. A personcanalsoberemovedfrom the system, but onlyif theyare on level 2 and not currentlywaitingfororaboardalift.Whencallingalift,aperson swipeshis/herID card, selectsa destination level/floor, and thenwaits.Thesystemusesan algorithmto select the most suitable lift and reportsthe numberofthatlifttothecaller.When the lift reachesthe caller’scurrent level, the caller boardstheliftunlesstheliftisheading in the opposite direction to that of the caller’sdestination. Whentheliftreachesthecaller’sdestination, the calleralightsfromthe lift. The lift will stop at alevelifanypersonwantsto board oralight.1Themostsuitableliftforacallerisdetermined bya suitabilityfunction. If a lift’sservice rangedoesn’tincludethecaller’scurrent level ordestination level, that lift’ssuitabilityis0.Otherwiseifaliftismoving awayfromthe caller, itssuitabilityis1. Otherwise if a lift ismovingintheoppositedirection that the callerwantsto go in, then itssuitabilityisN +1 DwhereNisthehighestminusthe lowest level of the building and D isthe distance in levelsbetweentheliftandthecaller. Otherwise, the lift’ssuitabilityisN +2 D. The most suitableliftforacalleristheliftwith the highest suitability.Anaside...
2. Specification. A secure research facility has hired _1
Whilereadingthethefirst part of the specification, you will notice there isa lot going on.● Howmanyfunctionsdid you identify?● Howmanyclassesdid you identify?● Whatarethefieldsin each class?● Howmanygoalsdid you identify?● Howmanypatternsdid you thinkof that might be applicable?Thisassignmentwillbechallenging and you will probablywant to manage your time well.● Howlongdoyouthinkit will take you to code the functions?● Howlongdoyouthinkit will take you to code each goal?Agoodruleofthumbistothinkof an estimate, and then multiplythat number by3 or 4!Tomanageyourtimewell, you mayneed to figure out which partsof the assignment youcanstartearly.● Whichpartscanyou start now?● Whichpartscanyou start in week5?Ifyoucompletepartsinthe same weekthat you learn the topics(while theyare fresh in yourmind),theywilltakelesstime to complete.TheUserInterfaceBelowisasampleI/Otrace. Not everyconceivablescenarioisshown below andyoushouldsubmityourcode to PLATEtoseewhatspecificscenariosare tested.BasicusageWhentheprogramlaunches, you will see a mode prompt which can be used to change thebehaviouroftheprogram.Mode:Forthemoment,let’sleave thisblankand pressenter. The menu isnow shown. Inputting anunrecognisedcommandresultsin the help being shown:Choice(a/r/p/c/l/o/x):?2Menua=addperson
2. Specification. A secure research facility has hired _2
r=removepersonp=showpeoplec=callliftl=showliftso=operateTheusercanadd,remove and show people registered in the system with the ‘a’, ‘r’ and ‘p’options.Eachpersonmust have a unique ID:Choice(a/r/p/c/l/o/x):aPersonID:1Name:SamWorthingtonChoice(a/r/p/c/l/o/x):aPersonID:1IDalreadyexistsChoice(a/r/p/c/l/o/x):aPersonID:2Name:NicoleKidmanChoice(a/r/p/c/l/o/x):aPersonID:3Name:HughJackmanChoice(a/r/p/c/l/o/x):pSamWorthington(1)onlevel2NicoleKidman(2)onlevel2HughJackman(3)onlevel2Choice(a/r/p/c/l/o/x):rPersonID:1Choice(a/r/p/c/l/o/x):rPersonID:1NosuchpersonChoice(a/r/p/c/l/o/x):pNicoleKidman(2)onlevel2HughJackman(3)onlevel2
2. Specification. A secure research facility has hired _3
Theliftsareshownwiththe ‘l’ option:Choice(a/r/p/c/l/o/x):lLift1|0|Lift2|0|Lift3|0|Eachliftisdisplayedasa string of dasheswith the left side representing the bottom of the liftandtherightsiderepresenting the top of the lift. One of the dashesisreplaced bya numberindicatinghowmanypassengersare currentlyaboard that lift. The position of thisnumberalsoindicatesthelocation of the lift within the shaft. Notice that Lift 2 and Lift 3 are shiftedrightbyonelevelbecause those liftsstart at level 2. Yourcode must not have anyspecialcasestodealwithdifferent lifts. Forexample, you cannot write code like this: if (liftNumber !=1){addanextraspace}.3Aliftcanbecalledwiththe ‘c’ option:Choice(a/r/p/c/l/o/x):cPersonID:1NosuchIDChoice(a/r/p/c/l/o/x):cPersonID:2Destinationlevel:4Choice(a/r/p/c/l/o/x):pNicoleKidman(2)onlevel2waitingtogotolevel4HughJackman(3)onlevel2Choice(a/r/p/c/l/o/x):lLift1|0|Lift2|0|Lift3|0|Themostsuitableliftischosen and the callerisadded to the lift’squeue. In thiscase, all 3liftsareequallysuitableso the first lift will be chosen. If there wasno suitable left (e.g. thedestinationwasnotserviceable byanylift), the call isdiscarded.Theliftsareoperatedviathe ‘o’ option. Here, each lift use thisalgorithm:
2. Specification. A secure research facility has hired _4

Found this document preview useful?

Related Documents
Factors Influencing Customer Satisfaction in Healthcare Centers: Designing Data Collection Tools

Network Design and Implement PDF

Apply Fluid and Thermodynamics Principles in Engineering - Assignment Part B