Create a class called Match that will have team objects and be used for creating a Match of play; the class must have the following data members and methods:
Data Members:
• This class has two data members named HomeTeam and VisitorTeam which are of type Team, they will store that two teams that will play the Match.
Methods:
• This class doesn’t have a default constructor, it only has one constructor which receives two Team object that will be assigned to HomeTeam and VisitorTeam.
• setTeams(),which receives two Team object that will be assigned to HomeTeam and VisitorTeam.
• playMatch(), simulates match play by calling the scoreGoals methods of each team.
• getPlayGound(), returns the ground of play which is the HomeGound of the HomeTeam.
• isDrawMatch(), will return true if the Match is a draw and false if there is a winner. The match is a draw if the goals of the teams are equal.
•
Comments
Leave a comment