Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use the JAVA QUESTION : You are going to develop a class to represent sports players. *For the instance variables, add the below ones.

image text in transcribedPlease use the JAVA

QUESTION :

You are going to develop a class to represent sports players.

*For the instance variables, add the below ones. Make sure that these values cannot be accessed from other classes.

Name of the player

Age of the player

Jersey number

*Write at least two constructors (not the default one)

*For this class, make sure you follow the encapsulation rules. (Add methods that you think are necessary for encapsulation)

*Override the toString method. Return everything in a proper format.

---------------------------------------

*Implement a class that will represent a soccer team.

*For the instance variables, add the below ones. Make sure that these values cannot be accessed from other classes.

name of the team

number of wins

number of losses

number of games played

players[]

*Write at least two constructors (not the default one)

*For this class, make sure you follow the encapsulation rules. (Add methods that you think are necessary for encapsulation)

*Write two additional methods. One of them will increase wins by one and the other one will decrease losses by 1.

*Write another method to decide if a team is good by returning true if wins are bigger than losses.

*Write another method to add players to this team.

*Write another method to search a player in this team by his/her name. If you can find it, return it.

*Write another method to search a player in this team by his/her jersey number. If you can find it, return it.

*Lastly add a method to increase the number of games. (When a team plays a game, you will increase this value by this method)

*Override the toString method. Return everything including the player names.

*Finally, use this class with a main method. The general flow is up to you. But make sure you use the methods you created in the classes.

Create a BAU Soccer Team, with random wins number and random losses number. Add a couple of players to this team. Search them. Make this team play a couple of times (when a team plays it should win or lose dont forget that) and call the necessary methods and at the end show us is the BAU team a good team or not.

WHEN YOU COPY PASTE YOUR CODE TO THE BELOW AREA, THE FORMAT SHOULD BE LIKE THIS:

COPY THE PLAYER CLASS

------------------------------- (ADD THIS DASHES TO SEPERATE THE CLASSES)

COPY THE TEAM CLASS

------------------------------- (ADD THIS DASHES TO SEPERATE THE CLASSES)

COPY YOUR MAIN METHOD

You are going to develop a class to represent sports players. *For the instance variables, add the below ones. Make sure that these values cannot be accessed from other classes. Name of the player Age of the player Jersey number *Write at least two constructors (not the default one) *For this class, make sure you follow the encapsulation rules. (Add methods that you think are necessary for encapsulation) *Override the toString method. Return everything in a proper format. #Implement a class that will represent a soccer team. *For the instance variables, add the below ones. Make sure that these values cannot be accessed from other classes. name of the team number of wins number of losses number of games played players *Write at least two constructors (not the default one) +For this class, make sure you follow the encapsulation rules. (Add methods that you think are necessary for encapsulation) *Write two additional methods. One of them will increase wins by one and the other one will decrease losses by 1. *Write another method to decide if a team is good by returning true if wins are bigger than losses. *Write another method to add players to this team. *Write another method to search a player in this team by his/her name. If you can find it, return it *Write another method to search a player in this team by his/her jersey number. If you can find it, return it. +Lastly add a method to increase the number of games. When a team plays a game, you will increase this value by this method) #Override the toString method. Return everything including the player names. #Cinalhe nice this place with a main mathal The reneral flaw in ta VAL But male Fur VALIce the metha VAL Prostor in the placer

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions