Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this question, we will simulate set of Football teams playing games in a league. In this question, you will develop the following classes: -

In this question, we will simulate set of Football teams playing games in a league. In this question, you will develop the following classes: - Team in (a) - Score in (b) - Game in (c) - League in (d) - Some extensions to Team are made in a more advanced question (e) Add appropriate validation testing in appropriate places to all classes.

(a) Create the class Team such that: - Constructor takes as input the name of the team and their location (as Strings) - Mutator methods to add points for a win (3) and for a draw (1), named addWin and addDraw respectively. - Accessor methods for the three variables: team name, location and current points - A toString method that returns a String representation of a team in the form: from currently has points. (Note the full stop at the end, and pay attention to when a team has only one point) - Hint: you may want an equals method or other useful methods for use in questions (d) and (e) marks for these additions are awarded in (d) and (e). The test case for this question is called: testTeam

(b) Create the class Score such that: - The constructor takes as input two int variables: the number of goals for the home Team and away Team respectively. - Score is immutable, and cannot take negative input - Has accessor methods the home and away Team score (number of goals scored): getHomeScore and getAwayScore. The test case for this question is called: testScore

(c) Create the class Game such that: - The constructor takes as input two Team objects and a Score object - A toString method that returns a String in the form for a win: - ; Result: Won; or for a draw: - ; Result: Draw Where represents the number of goals scored by the corresponding Team The test case for this question is called: testGame

(d) Create the class League such that: - It has a default constructor - Uses an ArrayList of Teams (to represent the League) - Has a method addGame, which based on the result calls the appropriate addWin or addDraw methods in the corresponding Team object (Hint: you will need to find it in the ArrayList) - A method addTeam, which adds a Team to the League (and prevents duplicate Teams) - A toString method that outputs the contents of the ArrayList (one Team per line displayed in the order they were added to the League; no ordering by points is necessary) The test cases for this question is called: testLeagueOne and testLeagueTwo

(e) Add a method orderedToString to League that reproduces the toString output but orders it by points, and tie breaks by goals scored. Hint: extensions will be needed to Team for this. The test cases for this question is called: testLeagueOrdered and testLeagueOrderedWithTie

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_2

Step: 3

blur-text-image_3

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

Tax Audit Guidelines For The State Of California Employment Development Department

Authors: State Of California, Employment Development Department

1st Edition

B0C1J7KT6R, 979-8390634066

More Books

Students also viewed these Accounting questions

Question

Differentiate Personnel Management and Human Resource Management

Answered: 1 week ago

Question

Describe the functions of Human resource management

Answered: 1 week ago

Question

What are the objectives of Human resource planning ?

Answered: 1 week ago

Question

Explain the process of Human Resource Planning.

Answered: 1 week ago

Question

Organizing Your Speech Points

Answered: 1 week ago