Question: JAVA A BaseballPlayer has a name, a number of hits, and a number of at-bats. A BaseballPlayer can be created with a name, or with
JAVA
A BaseballPlayer has a name, a number of hits, and a number of at-bats. A BaseballPlayer can be created with a name, or with all three data. Provide a getter and setter for any one instance variable (your choice of which). Also, provide a getBattingAverage() method that calculates and returns the BaseballPlayer's batting average which is the number of hits divided by the number of at-bats.
NOTE: The BaseballPlayer class is an object class (a class designed to make objects from), not a driver class. So, there will be no main method. Please feel free to write a driver class to test your BaseballPlayer class in Eclipse if you wish!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
