Introduction and Workshop Tasks You will create at least the following classes in addition to other classes that are giv
Posted: Fri Jul 08, 2022 6:15 am
Introduction and Workshop Tasks
You will create at least the following classes in addition toother classes that are given to you:
A sports association is going to contain an aggregate of sportsteams. In our workshop, there are two types ofsports teams - a hockey team anda baseball team.A hockey team will keep track of ateam's wins, losses, ties and willcalculate points based on these. A baseball teamwill keep track of a team's wins andlosses and will calculate a winning percentage basedon these (percentage in the context of baseball is a numberbetween 0.000 and 1.000).
The main sports association program will create one sportsassociation and add teams to it based on user input.
For this workshop, the main sports association program is givento you: SportsMain.cpp. The Team abstract base class is alsogiven to you as well as source code for creating ateam: Team.h and Team.cpp.
More details are given below:
The Team Abstract Class
The Team abstract class contains three functions (pure virtual)which will be completed in the derivedclasses:
Team.cpp contains a function to create a team based on userinput:
The Baseball Team
The baseball team completes the abstractclass and adds a constructor. The baseball team hasa name, the number of wins, the number of losses, andthe winning percentage:
The Hockey Team
The hockey team completes the abstract classand adds a constructor. The hockey team has a name,the number of wins, the number of ties, the number of losses, andthe total points:
The Sports Association
The sports association has a name and containsan aggregate of teams. These teams couldbe hockey teams, baseball teamsor both. We will limit the number of teams to 4. It has thefollowing functions:
Be sure to add comments throughout the code wherenecessary.
You will create at least the following classes in addition toother classes that are given to you:
A sports association is going to contain an aggregate of sportsteams. In our workshop, there are two types ofsports teams - a hockey team anda baseball team.A hockey team will keep track of ateam's wins, losses, ties and willcalculate points based on these. A baseball teamwill keep track of a team's wins andlosses and will calculate a winning percentage basedon these (percentage in the context of baseball is a numberbetween 0.000 and 1.000).
The main sports association program will create one sportsassociation and add teams to it based on user input.
For this workshop, the main sports association program is givento you: SportsMain.cpp. The Team abstract base class is alsogiven to you as well as source code for creating ateam: Team.h and Team.cpp.
More details are given below:
The Team Abstract Class
The Team abstract class contains three functions (pure virtual)which will be completed in the derivedclasses:
Team.cpp contains a function to create a team based on userinput:
The Baseball Team
The baseball team completes the abstractclass and adds a constructor. The baseball team hasa name, the number of wins, the number of losses, andthe winning percentage:
The Hockey Team
The hockey team completes the abstract classand adds a constructor. The hockey team has a name,the number of wins, the number of ties, the number of losses, andthe total points:
The Sports Association
The sports association has a name and containsan aggregate of teams. These teams couldbe hockey teams, baseball teamsor both. We will limit the number of teams to 4. It has thefollowing functions:
Be sure to add comments throughout the code wherenecessary.