logo

Object Oriented Programming Assignment: Championship Simulation

8 Pages1988 Words443 Views
   

Added on  2019-09-23

About This Document

This assignment requires the implementation of a program that can simulate a championship between competitors such as sport teams or individual players using class and function templates, namespace, STL, stream manipulators, code reuse, UML diagrams, and typeid(). The program shall be well structured and designed based upon concepts of object oriented and generic programming. The solution shall implement the structure shown on the UML diagram provided in the assignment. The program shall properly manage dynamic memory allocation.

Object Oriented Programming Assignment: Championship Simulation

   Added on 2019-09-23

ShareRelated Documents
Purpose:Getpracticalexperienceinusing-Classandfunctiontemplates-Namespace-STL-streammanipulators-codereuse-UMLdiagrams-typeid()GeneralRequirementsFollowtheprinciplesofOOandgenericprogrammingPutyourname,studentnumberatthebeginningofeachfilesubmitted/*------------------------------------------------- Student's Name:Student'semailaddress:Laboratorygroup(groupcodeandtime): Purposeofthisassignment:-------------------------------------------------------*/AddcommentstothesourcecodetomakeyoursolutioneasiertofollowAssignment requirementsWriteaprogramthatcansimulateachampionshipbetweencompetitorssuchassportteams(soccer,hockey, etc), orindividualplayers(tennis,ping-pong,badminton,etc). Youcanreusecodefromyourownassignment2 solution.If yourassignment2codewaswellstructuredaccordingtotheOOM,it canbeefficientlyreused.The majorobjectiveof thisassignmentistogetpracticalexperiencewithobjectandgenericprogramming.Sportcompetitionsimulationrequirementsaredeliberatelysimplified.BACKGROUNDThestructureofthesimulationissuchthatagivennumberofcompetitorsplayinaleagueona doubleround- robinbasis,in whicheverycompetitorplayswithallothersinthe leagueonceathomeandonceaway.Itmeans thatiftherearencompetitors,therewouldben*(n1)gamesplayed.Competitorsreceivetwopointsforawinandonepointforadraw(ifdrawsarepermitted).Nopointsare awardedforaloss.Drawsarepermittedforteams,butdrawsarenotpermittedforindividualplayers.Compititors are ranked according to the following criteria:
Object Oriented Programming Assignment: Championship Simulation_1
1.By the total points first;2.Forcompetitorswithanequalnumberofpoints,bygoaldifference(i.e.thenumberof goalsscoredforminusthenumberofgoalsscoredagainst);3.Ifthegoaldifferenceis alsothesame,bygoalsscoredfor.4.If stillequal,thecompetitorswilloccupythesameposition.CODING REQIREMENTSYourprogramshallbewellstructuredanddesignedbaseduponconceptsofobjectorientedand genericprogramming.Yourprogramshallbesubdividedintoseveral.hand.cppfiles.Youalsoneedtoprovideamakefile tocontrolcompilationof yourprogramandproduceasm3.exeexecutablefile.Youcanselectany appropriatetemplatecompilationmodelsupportedon banshee.Theprogramshalldefineclasses,classtemplatesandfunctiontemplatesto simulatechampionshipsforteamsor individualplayersdependingonthetypeexplicitlyspecified(TeamorPlayer).ClassesTeam,Playerand OrganizingCommitteeshallbedefinedinanamespaceasm3.Yoursolutionshallimplementthestructure shownontheUMLdiagrambelow:asm3TeamPlayerOrganizingCommitteeChampionshipT:class,maxScore:intthatcanbeTeamor2..n 2..n*(n-1)T 2GameT:class,maxScore:int
Object Oriented Programming Assignment: Championship Simulation_2
AUMLdiagramthatdescribestheprogramstructure,whereTisaparameterizedtypeTeamorPlayerTheclasstemplateChampionshipshallhaveac-stringdatamembertostorethecompetitortype.Italsoshall useanSTLvectortostoretherequirednumberofobjectsoftypeT. Itshallgenerateallpossiblen*(n1) gamesplayedinarandomorderamongtheteamsforthewholeseason.Itshallrunthechampionshipwhena member function (implemented asa template) Championship::runChampionship()is called fromOrganizingComittee::start(...). Onceallgameshavebeenplayed,oneofthememberfunctionsshall printatablewiththeresultsofthechampionshipaccordingtotherequiredoutputformat(seebelow).TheclassTeamshallhaveadatamembernametostoreateamname,andalsoothermemberstostoretotal points,goalsscoredforandgoalsscoredagainst,whichshouldbeupdatedduringthechampionship. The privatedatamemberspoints,goalsscoredforandgoalsscoredagainstshallbeupdatedandaccessedthrough publicmethods.Tomakeimplementationsimple,teamnamesshouldbe:Team1,Team2,Team3,...Youalso needtoimplementthe<,>,==,!=overloadedoperatorstocompareteamsbasedontherankingcriteria describedearlier.If otheroperatorsareneeded,theyshouldbeimplementedtoo.
Object Oriented Programming Assignment: Championship Simulation_3

End of preview

Want to access all the pages? Upload your documents or become a member.