00:01
In this question, we have to write a code in java.
00:04
So let us look at the brief explanation or what we have to do in this question.
00:10
So first of all, we have to create a player class.
00:14
So for that we have to create a player class.
00:28
So here the player class will represent a basketball player and it should have instance variables such as name, height and it should also have the constructors which we will see in the program.
00:44
So it will have some variables such as name and height.
00:54
Then let us look at the second thing that we need.
00:57
We need a team class.
01:00
So these are all the things that we are fulfilling from our query that we need.
01:06
So this class that is team class, this represents a basketball team.
01:11
It should have an instance variable that is an array of player objects.
01:18
So and an instance of variable to indicate the next open position in the team members array.
01:27
So next we have to create is a game class.
01:33
So like this.
01:36
So the game class here is responsible for interacting with the user and managing the teams.
01:45
So it should have the private static that is scanner variable for reading user input.
01:51
The game class should also have a method that is fill roaster that prompts the user to enter player data for the team.
02:00
So now let us see how we have to implement all this in a program and for that we'll see in a basic compiler on how we will be doing this.
02:11
So first we will be starting by importing the basic java scanner.
02:19
So this is like a basic header file.
02:23
Then we will start by defining the player class.
02:26
Now as we saw that this class will represent the basketball player and its instance variables.
02:32
So we will define this player class.
02:36
It will have the instances that is string name and height.
02:40
These are in inches.
02:41
Then it has two constructors that is one takes the name that is this dot name and the other takes the height that is height.
02:50
So these are the parameters and another no argument constructor.
02:54
So it also includes getters and setters for name and height.
02:59
So for that we will see how we are going to do that.
03:06
So we will write these one second.
03:11
For the getters and setters we will write these after we are done with the main thing over here.
03:24
So like this.
03:25
So as you can see here that we have set the getters and setters for name and height and an overridden two string we have to give here.
03:40
So like this.
03:43
So now that we have done that also...