Answered step by step
Verified Expert Solution
Question
1 Approved Answer
- Write a class named Basketball that has the following: - Fields (attributes): - Name of the team: String - Number of wins: int Constructor
- Write a class named Basketball that has the following: - Fields (attributes): - Name of the team: String - Number of wins: int Constructor and other methods: - First Constructor: accepts the name of the team, the number of wins as arguments and sets the class properties to those values. - Second Constructor: takes only the name of the team as an argument. This constructor should set the name of the team to the argument and sets the number of wins to 0 . - Accessors and Mutators: setters and getters for name of the team, and the number of wins. - Print Method: prints the name of the team and the numbers of wins. - Write a class named BasketballTeam, that has the main method, to do the following: - Create two objects of class Basketball using the two constructors above. - The teams' names are filled off the top of your head. - Fill the wins of the teams as follows: - The number of wins of the first team is filled with a random number in the range 010 upon creation of the object. - The number of wins of the second team is filled with a random number in the range 0 -10 using the wins mutator method. - Print the above objects' contents using your print method
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started