Sunteți pe pagina 1din 2

Lab6FromCodetoUMLtoCode

Thisassignmentcanbedoneinpairs. Objective TolearntocreateaUMLdiagramoutofexistingcode,andtolearnthestructureofanapplicationin theprocess.Additionally,learntofirstchangeamodelbeforeapplyingchangestocode. Thisisashortassignmentandcanbefinishedduringthelabsession. Task1 1. Downloadthefilelab6.zippostedonMoodle. 2. Importanewprojectintoeclipseandselectthezipfileyoujustdownloaded. 3. Youwillfindseveraljavafilesintheproject,yourtaskistodrawtheUMLdiagramthat representsthecodeinsidethepackagelab6.wordprocessor.java.Youshouldspecifyallthe classes,variables,methods,relationships,etcusingtheappropriatesymbolssothatthe diagramdescribeeverydetailofthecode.(Note:Werecommendtofirststartdrawingthe diagrambyhandandthenuseanytooltoformatitandturnitin.) 4. AfteryoufinishedyourUMLdiagramidentifyandaddacommentinyourdiagramspecifying whichpatternistheapplicationusing. Task2 Inthispartyouaregivenanewsetofrequirementswhichyouwouldneedtoimplement.Youshould firstapplyyourchangestoyourUMLmodelandthenmodifythecode.(YoucanaskaTAtocheckif yournewmodelisokbeforeproceeding). Newrequirements: 1. AWordProcessorcanhavemaximum5documents.Ifyouattempttoaddanewdocument andtherearealready5documents,themethodshouldthrowanexceptioncalled WordProcessorException. 2. ThecurrentimplementationoftheDocumentclasscontainsalistofstringswhichrepresent thelinesofthefile,nowtheDocumentshouldcontainPagesandthesepagesshouldbethe onescontainingthelistoflines.Thedocumentshouldcontainatleastonepage.Modifyyour Documentclassandanyotherclassthatcouldbeimpactedwiththischange.Rememberto firstmodifyyourmodeltovisualizetherequiredchanges.(Hint:Pageisanewjavaclass) 3. Addanewprinterbehaviour.ThisnewprintershouldbenamedNormalStatisticsPrinter.This printerprintsthetextwithoutanymodificationandattheenditalsoprintsastatisticssection aboutthedocumentasfollow: DocumentStatistics:56Characters,3Lines,2Pages

ThefileWordProcessorTestApp.javacontainstwomainmethods(onecommentedout).Thefirst oneisforyoutoseehowtheapplicationworks.Thesecondistotestyourimplementationofthenew requirements.Afterimplementingallofthemandexecutingthetestappyoushouldseetheoutput likethis: HELLO WORLD hello world Hello wOrlD 10Characters,2lines,1pages. lab6.wordprocessor.java.WordProcessorException:Documentslimitreached atlab6.wordprocessor.java.WordProcessor.AddDocument(WordProcessor.java:23) atlab6.wordprocessor.test.WordProcessorTestApp.main(WordProcessorTestApp.java:49) TurnIn Onceyouaredonewiththelabyoushouldturninthefollowing: 1.OriginalUMLModel 2.ModifiedUMLModel 3.Exportedlab6project Specifythenameofyourfinalfilefollowingthisnamingconvention: Lab6_<firstname1lastname1>_<firstname2lastname2>.zip Forexample,ifManuelEspinozaworkedwithMichaelKirby,theirfilenameshouldbe: Lab6_ManuelEspinoza_MichaelKirby.zip FinallyuploadthatfiletomoodleINDIVIDUALLY.Eachteammembershoulduploaditsownfileeven thoughweknowisthesamecode.

GOODLUCK!

S-ar putea să vă placă și