Ask a question to Desklib · AI bot

Ask NowBETA

Object Oriented Programming Assignment: Championship Simulation

Added on -2019-09-23

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.
| 8 pages
| 1988 words
| 443 views

Trusted by 2+ million users,
1000+ happy students everyday

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:
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
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.

Found this document preview useful?

You are reading a preview
Upload your documents to download
or
Become a Desklib member to get accesss

Students who viewed this