Purpose: Get practical experience in using.

Added on - Sep 2019

Trusted by 2+ million users,
1000+ happy students everyday
Showing pages 1 to 3 of 8 pages
Purpose:Getpracticalexperienceinusing-Classandfunctiontemplates-Namespace-STL-streammanipulators-codereuse-UMLdiagrams-typeid()GeneralRequirementsFollowtheprinciplesofOOandgenericprogrammingPutyourname,studentnumberatthebeginningofeachfilesubmitted/*-------------------------------------------------Student'sName:Student'semailaddress:Laboratorygroup(groupcodeandtime):Purposeofthisassignment:-------------------------------------------------------*/AddcommentstothesourcecodetomakeyoursolutioneasiertofollowAssignment requirementsWriteaprogramthatcansimulateachampionshipbetweencompetitorssuchassportteams(soccer,hockey,etc),orindividualplayers(tennis,ping-pong,badminton,etc).Youcanreusecodefromyourownassignment2solution.Ifyourassignment2codewaswellstructuredaccordingtotheOOM,it canbeefficientlyreused.Themajorobjectiveofthisassignmentistogetpracticalexperiencewithobjectandgenericprogramming.Sportcompetitionsimulationrequirementsaredeliberatelysimplified.BACKGROUNDThestructureofthesimulationissuchthatagivennumberofcompetitorsplayinaleagueona doubleround-robinbasis,inwhicheverycompetitorplayswithallothersintheleagueonceathomeandonceaway.Itmeansthatiftherearencompetitors,therewouldben*(n1)gamesplayed.Competitorsreceivetwopointsforawinandonepointforadraw(ifdrawsarepermitted).Nopointsareawardedforaloss.Drawsarepermittedforteams,butdrawsarenotpermittedforindividualplayers.Compititors are ranked according to the following criteria:
1.By the total points first;2.Forcompetitorswithanequalnumberofpoints,bygoaldifference(i.e.thenumberofgoalsscoredforminusthenumberofgoalsscoredagainst);3.Ifthegoaldifferenceisalsothesame,bygoalsscoredfor.4.If stillequal,thecompetitorswilloccupythesameposition.CODING REQIREMENTSYourprogramshallbewellstructuredanddesignedbaseduponconceptsofobjectorientedandgenericprogramming.Yourprogramshallbesubdividedintoseveral.hand.cppfiles.Youalsoneedtoprovideamakefiletocontrolcompilationofyourprogramandproduceasm3.exeexecutablefile.Youcanselectanyappropriatetemplatecompilationmodelsupportedonbanshee.Theprogramshalldefineclasses,classtemplatesandfunctiontemplatestosimulatechampionshipsforteamsorindividualplayersdependingonthetypeexplicitlyspecified(TeamorPlayer).ClassesTeam,PlayerandOrganizingCommitteeshallbedefinedinanamespaceasm3.YoursolutionshallimplementthestructureshownontheUMLdiagrambelow:asm3TeamPlayerOrganizingCommitteeChampionshipT:class,maxScore:intthatcanbeTeamor2..n2..n*(n-1)T2GameT:class,maxScore:int
AUMLdiagramthatdescribestheprogramstructure,whereTisaparameterizedtypeTeamorPlayerTheclasstemplateChampionshipshallhaveac-stringdatamembertostorethecompetitortype.ItalsoshalluseanSTLvectortostoretherequirednumberofobjectsoftypeT.Itshallgenerateallpossiblen*(n1)gamesplayedinarandomorderamongtheteamsforthewholeseason.Itshallrunthechampionshipwhenamemberfunction(implementedasa template)Championship::runChampionship()iscalledfromOrganizingComittee::start(...).Onceallgameshavebeenplayed,oneofthememberfunctionsshallprintatablewiththeresultsofthechampionshipaccordingtotherequiredoutputformat(seebelow).TheclassTeamshallhaveadatamembernametostoreateamname,andalsoothermemberstostoretotalpoints,goalsscoredforandgoalsscoredagainst,whichshouldbeupdatedduringthechampionship.Theprivatedatamemberspoints,goalsscoredforandgoalsscoredagainstshallbeupdatedandaccessedthroughpublicmethods.Tomakeimplementationsimple,teamnamesshouldbe:Team1,Team2,Team3,...Youalsoneedtoimplementthe<,>,==,!=overloadedoperatorstocompareteamsbasedontherankingcriteriadescribedearlier.Ifotheroperatorsareneeded,theyshouldbeimplementedtoo.
Desklib Logo
You are reading a preview
Upload your documents to download or

Become a Desklib member to get access