I have an assignment for Java due 22hours from when I post this, this assignment should be fairly easy to an experienced Java programmer. I guess what I'm' asking is for someone to complete the project and show me theirs so I can continue where I got stuck and see what I'm doing wrong (I'm stuck on question 5). If you see this post after its due and feel like doing it please go ahead, the more help the better. The assignment goes as followed.

For this assignment, you will write a program to compile the statistics of baseball players. For simplicity, we will not read the data from the user, but just hardcode it in our program. Here is what the output of your program would look like (Joe and Jerry are 2 baseball players here):

Statistics for Joe
atBats=11 hits=3 home_runs=1 avg=0.273
Statistics for Jerry
atBats=6 hits=3 home_runs=1 avg=0.500
Jerry (0.500) has a better average than Joe (0.273)
Number of Home Runs for Joe: 1
Number of Home Runs for Joe after the change: 0

Steps:
1. Create 2 classes: one driver class (with the main method) and one class named “BaseballPlayerStats”.

2. Add the following instance variables to your BaseballPlayerStats class: • Name of the player • Number of times at bats • Number of hits • Number of home runs • Number of games played

3. Add a constructor that initializes the name to the one passed in the parameters, and resets all other variables to zero.

4. Add a method “playGame” that will be used to update the statistics based on a new game played. This method should have the following parameters: number of times at bats for that game, as well the number of those that were hits and the number of those that were home runs (note: a home run counts both as home run and a hit). Your method should take these 3 numbers and increase the respective instance variable by such numbers. Your method should also add 1 to the number of games played. There is nothing returned by this method.

5. In the main method, create an object representing the baseball player Joe. Make him play 3 games, with the following statistics:
Game 1: at bats = 4; hits = 2; home runs = 0
Game 2: at bats = 3; hits = 0; home runs = 0
Game 3: at bats = 4, hits = 1; home runs = 1

6. Add an accessor method for the name variable in the BaseballPlayerStats class. In the main method, call this method and use its result to print the first line of output above.

7. Add a method “calculateAverage” in the BaseballPlayerStats class, with no parameter. In this method, calculate the average for the player as the number of hits divided by the number of times at bats. Note: type cast one of your variable to a double in order to force the use of the regular division, not the integer one (which would always return 0 as a result here!). Return the result.

8. Add a method “printAllStats” in the BaseballPlayerStats class, with no parameters and returning nothing. Make this method print a line like the second one in the expected output above. Of course, you should use the values stored in the instance variables, not just printing that exact string! For the average part, you should first get it by calling the calculateAverage method. You should also print it with exactly 3 decimal places. Finally, the whole line is indented using one tab at the beginning. In your main method, add a line of code to call this printAllStats method.

9. In the main method, create a second baseball player Jerry. Do the same method calls as for Joe in order to print the 3rd and 4th line of output above. Here are the games played by Jerry and his statistics:
Game 1: at bats = 1; hits = 1; home runs = 1
Game 2: at bats = 5; hits = 2; home runs = 0

10. Add a “toString” method in the BaseballPlayerStats class. Make it build a string such as “Joe (0.273)”. The number in parentheses is obtained by calling the calculateAverage method, and formatting it nicely to exactly 3 decimal places.

11. In the main method, write a System.out.println statement that produces the 5th line of output above. You do not have to make the comparison yourself: just print the object representing Jerry, then the words “has a better average than”, and finally the object representing Joe.

12. Add an accessor and a mutator method for the instance variable representing the number of home runs.

13. In the main method, write the code to print the 6th line of output above. You should get the number of home runs by calling the related accessor method. Then use the mutator method to change the number of home runs to zero, and print the last line of output above (again calling the accessor method).