Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Grading policies: Data validation/reading form a file Proper naming Following the assignment All the data must be read from a file. No manual input Note:

Grading policies:

Data validation/reading form a file

Proper naming

Following the assignment

All the data must be read from a file. No manual input

Note: you can add any extra features of your choice as long as you implement all the requirements.

Note: make sure that your methods accept parameters of type object where applicable

Use instanceof to check the data type of the object

Use type casting to cast the object into the appropriate data type..

Create the following hierarchy of classes

Create a class called player with the following UML diagram

Player

-String name

-double salary

-int number

+Player(String name, double salary, int number) setter methods getter methods equals method

tostring method

Create a class called BasketBall player that extends the player class.

BasketBallPlayer

-int threePointer

-int turnOvers

-int assist

-int rebounds

-int twoPointers

-String teamName

+constructor

+setter methods

+getter methods

+equals

+toString

+getTotalPoints(): int// returns the total points made by the palyer

Create a class called soccer player that extends the player class.

Soccer

-int goals

-int fouls

-int redCard

-int yellowCard

-Int offside

-int assist

-String teamName

+constructor

+getter methods +setter methods

+toString method

+equalsMethod// accepts an object as its parameter

+pullOutPlayer(): Boolean// if the player has more than three fouls or two yellow card then the player cannot play and this method should return false

Create a class called soccerTeam. This class has an array of 15 players

-ArrayList team

An array list of SoccerPlayer

+constructor()

Reads the info for the players from a file and creates an object of SoccerPlayer and then store it in the array arrayList called team

+add(Object o)

+add(Object o, int pos)

Adds the object at the given position

Adds the object to the list

+getter method

Returns the object team of ArrayList type

+selectTheBest()

Return the player with the most goals

+selectMostRed

Returns the player with the most red card

+toString

Returns a string representing all the players in the team. A for loop is needed

+equlas(Object other)

Returns true if the team this is the same as the team other. Need a loop to compare all the players.

Remove(Object o)

Remove(int index)

Removes the object(Player) from the list

Removes the object(player at the given index

Create a class called basketBallTeam that has the same/similar features as step 4

Create a driver class that does the following:

Create a main method

Create two data files for the basketball team and the soccer team. These two files will be used by the constructors in the Soccer class and basketball class.

Create an object of SoccerTeam call it bearCat

Create an object of BasketBallTeam call it kings

Call the methods in step 8

Create the following methods

Create a method called listPlayers, this methods accepts an array of players and displays the info about all the players. Call this method two times using the object kings and bearCat. You must use the same method

Write a method that accepts an array of SoccerPlayer and lists all the players with red card.

Write a method called mostRebound that displays the player with the most rebound

Write a method called serachPlayer that accepts an array of type Player and a name of a player. This methods searches the list , if the player is found display the info, otherwise print a message that the player does not exist.

Write a method that display the best player with the most goals/points.

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

Students also viewed these Databases questions

Question

Define dependent variables.

Answered: 1 week ago