Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this project, you have to design a Club class and use it to create an application that simulates a soccer league tournament. You are

In this project, you have to design a Club class and use it to create an application that simulates a
soccer league tournament. You are not limited to the features included in these instructions, feel
free to add any other components you find useful.
Design the Club class, to be used in your application, containing:
A private data member code of type string that holds the three letters clubs abbreviation
(ex, FCB, LIV, RAM ...)
A private data member name of type string that holds the clubs name (ex, FC Barcelona,
Liverpool, Real Madrid ...)
A private data member round of type integer that holds the number of rounds the club has
played so far in the current league.
A private data member wins of type integer that holds the number of times the club has
won in the current league.
A private data member draws of type integer that holds the number of times the club has
been drawn in the current league.
A private data member losses of type integer that holds the number of times the club has
lost in the current league.
A private data member goals of type integer that holds the number of goals the club has
scored in the current league.
A private data member goalsConceded of type integer that holds the number of goals the
club has conceded in the current league.
A private data member strength of type integer that holds a number representing the clubs
strength. The higher the number, the stronger the club.
A default constructor that sets all integer member variables to 0.
Accessors for each member variable.
Mutators for each member variable.
A member function that generates, depending on the strength of the club, a random integer
that simulates the number of goals scored in a game. There are many approaches to
generating this random number. The easiest way is that a club with strength X will score
a random integer between 0 and X in a game. So teams with higher strengths like Liverpool
or Manchester City will likely score more goals than teams with lower strengths such as
Norwich or Watford (I apologize if you are a fan of these clubs). Thus, the purpose of using
the strength variable is to make the results of games more realistic. If you give your
favorite team a very high score, your team will win the league most of the time. For
accurate strengths, you can check the club rankings that FIFA provides periodically, or just
check out the history of a few past leagues to see how clubs have performed recently.
A member function that calculates and returns the number of points the club has
accumulated so far. This number is calculated from the number of wins and draws; a win
worth 3 points and a draw worth 1 point (that is, a loss is worth 0 points). Example, if in
round # 10 a club has 5 wins, 2 draws and 3 losses, the number of points accumulated so
far is 17(that is,15+2+0).
A member function that calculates and returns the difference between the number of goals
scored and the number of goals conceded by the club so far.
The overloaded Boolean operator greater than or equal to (>=) which returns true if the
left operand club has a higher or equal position in the ranking table compared to the right
operand club; and returns false otherwise. Club rankings are determined by the number of
points accumulated and goal differences as follows. Club A ranks higher than club B if the
number of points accumulated by A is greater than the number of points for B. If the
numbers of points are equal, the club with the higher rank is the one with the greatest
difference between goals scored and conceded. If these differences are also equal, the club
with the most goals scored is ranked higher.
Besides the above member functions, you can consider using any other useful functions to
accomplish the task at hand. Functions can be members of the Club class, friends of it, or just
regular stand-alone functions.
Write a program that thoroughly tests your Club class. The program should simulate soccer games
of your favorite league for the entire season; for example, a league with 20 clubs will have 38
rounds of 10 games each. Each pair of teams will meet twice during the season (as home team and
away team).
The ranking table should be updated after each round, and your application should be able to
display fixtures, results, and standings from any round.
One of the most difficult parts of this project is finding the fixtures board (games schedules for all
rounds). No need to worry, the schedule table for 20 clubs can be found on the course webpage. If
your application is simulating a league with fewer clubs (18 or 16), you will need to build this
table
C++ format

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions