Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in java 2. Write the implementation of the above mentioned classes using inheritance and according to the specifications and requirements given below: - You

Code in java

image text in transcribedimage text in transcribed

2. Write the implementation of the above mentioned classes using inheritance and according to the specifications and requirements given below: - You must have 5 different Java packages for the classes. First package will include SoccerPlayer class. Second will include Goalkeeper class. Third package will include Defender, CentreBack, Sweeper, WingBack classes. Fourth package will include DefensiveMidfielder, CentreMidfielder, WideMidfielder, Midfielder classes. Lastly, fifth package will include Forward, Centre Forward Winger, and Striker classes. For each of the classes, you must have at least three constructors, a default constructor, a parametrized constructor (which will accept enough parameters to initialize ALL attributes of the created object from this class) and a copy constructor. For instance the parametrized constructor of the CentreBack class must accept total 9 parameters to initialize name, dob, clubName, countryName, numYellowCards, numRedCards, gamesPlayed, numTackles and " shotsBlocked An object creation using the default constructor must trigger the default constructor of its ancestor classes, while creation using parametrized constructors must trigger parametrized * constructors of the ancestors For each of the classes, you must include at least following methods: accessors, mutators, - toString0 and equalsO methods (notice that you are always overriding last two methods) The toString0 method must display clear description and information of the object (i.e "XXX (to be replaced by the player's name) is a CentreBack player. He is from X (name of the country) country and plays for X (name of the club) club. Finally all the relevant stats for this player The equalsO method must first check if the passed object (to compare to) is null and if it is of a different type than the calling object. The method would clearly return false if any of these conditions is true; otherwise the comparison of the attributes are conducted to see if the two objects are actually equal. You need to add a comment indicating how effective these null verifications will be in relation to protecting your program from crashing! For all classes, you are required to use the appropriate packages access rights. - When accessing attributes from a base class, you must take full advantage of the permitted rights. For instance, if you can directly access an attribute by name from a base class, then you must do so instead of using a public method from that base class to access the attribute * 3. Write a driver program that contains the main) method) that would utilize all of your classes. The driver class can be in a separate package or inside any of the already existing five packages. In the main) method you must: Create various objects from all the 14 classes, and display all their information using the toString0 method. - Test the equality of some to the created objects using the equals) method. Create an array of 18 SoccerPlayer objects and fill that array with various objects from the 14 classes (each class must have at least one entry in that array). Trace(search) that array to find the player(s) with: (a) the most number of goals scored (b) the least number of goals saved (c) same club association For all the queries display all information of the players along with their location (index) in " array

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Draw the nine chiral molecules that have the formula C6H13Br.

Answered: 1 week ago

Question

Have roles been defined and assigned?

Answered: 1 week ago