Question: 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

Java Define a class for a soccer (futbol) player. Each player has

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!