Question: Write a java class encapsulating the concept of statistics for a baseball team, which has the following attributes: a number of players, a list of
Write a java class encapsulating the concept of statistics for a baseball team, which has the following attributes: a number of players, a list of number of hits for each player, a list of number of at-bats for each player. Write the following methods: A constructor with two equad lenght arrays as parameters, the number of hits per player, the number of at-bats pers player. Accessors, mutators,toString and equals method. Generate and return an array of batting averages based on the attributes given. Calculate and return the total number of hits for the team. Calculate and return the number of players with a batting average greater than .300 A method returning an holding the number of hits, sorted in ascending order. Write a client class to test all the methods in your class and write comments.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
