I'm struggling to understand the instructions for my project, english is my second language so can someone help break it down and assist me in how i would go about this project?
Project Summary
Write a program that produces statistics for a baseball team.
Instructions:
Create the BaseballStats class:
It has two instance variables:
teamName, a String
battingAverages, an arrays of doubles representing the batting averages of all the players on the team.
The class has the following API:
Constructor:
public BaseballStats( String filename )
The team name and the batting averages for the team are stored in the file. You can assume the first item in the file is the team name (one word – no spaces), followed by exactly 20 batting averages. Your constructor should read the file into the teamName instance variable and the battingAverages array.
Methods:
public String getTeamName( )
accessor for teamName
public void setTeamName( String newTeamName )
mutator for teamName
public double maxAverage( )
returns the highest batting average
public double minAverage( )
returns the lowest batting average
public double spread( )
returns the difference between the highest and lowest batting averages
public int goodPlayers( )
returns the number of players with an average higher than .300
public String toString( )
returns a String containing the team name followed by all the batting averages formatted to three decimal places.
Client class:
Your client should instantiate an object of the BaseballStats class, passing the name of the text file containing the team name and the averages. The client should then call all methods, reporting the results as output.