Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Define a class for a soccer (futbol) player. Each player has the following properties or characteristics: a name (a String) a team (a String)
Java
Define a class for a soccer (futbol) player. Each player has the following properties or characteristics: a name (a String) a team (a String) number of games played an integer) total number of goals scored an integer) Provide the following functionality: a constructor (given name and team, start the others at zero) a toString method accessors for each property a method to compute and return the average goals per game a mutator method, given the number of goals scored in one game, update the number of games and the goals scored. a mutator method, to set the team to the given team. Also define a class to test this one containing a main program that does the following: instantiate a player for Cristiano Ronaldo with Real Madrid. output all the information on Ronaldo (from the instance). update Ronaldo's information for one game scoring 3 goals. update Ronaldo's information for one game scoring 1 goal. output the average goals per game for Ronaldo. output just Ronaldo's team (from the instance). change Ronaldo's team to Juventus. output all the information on Ronaldo (from the instance). Notice that there is no input from the user. This does not have to be compiled and tested
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