subject

The BaseballPlayer class stores the number of hits and the number of at-bats a player has. You will complete this class by writing the constructor. Write a method called: public BaseballPlayer The constructor should take three parameters to match the three instance variables in the class and then initialize the instance variables with these parameters. The parameters should be ordered so that the name of the baseball player is input first, then their hits, and at bats. In the BaseballTester class, print a call to printBattingAverage to test your constructor. 5.2.5: Batting Average 1 public class Baseballtester 2-{ 3 4- 5 6 7 8 public static void main(String[] args) { BaseballPlayer babeRuth = new BaseballPlayer("Babe Ruth", 2873, 8399); System. out. println(babeRuth); // Call the function printBattingAverage here } 9 10 11 12 0 5.2.5: Batting Average 1 public class Baseballplayer 2-{ private int hits; private int atBats; 5 private String name; // Add constructor here public void printBattingAverage { double battingAverage hits / (double) atBats; System. out. println(battingAverage); } 6 7 8 9 10 - 11 12 13 14 15 16 - 17 18 19 20 21 public String toString() { return name + ": + hits + "/" + atBats; } }

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
Type the correct answer in the box. spell all words correctly. under which key category do the page up and page down keys fall? page up and page down keys fall under the keys category.
Answers: 3
question
Computers and Technology, 23.06.2019 12:20
When guido van rossum created python, he wanted to make a language that was more than other programming languages. a. code-based b. human-readable c. complex d. functional
Answers: 1
question
Computers and Technology, 24.06.2019 06:30
For which utilities, if any, does the landlord pay?
Answers: 2
question
Computers and Technology, 25.06.2019 01:30
What was the advantage of using transistors instead of vacuum tubes in the second-generation computers? a. computers were drastically reduced in size. b. computers no longer produced errors. c. computers became affordable. d. computers could run on electricity.
Answers: 1
You know the right answer?
The BaseballPlayer class stores the number of hits and the number of at-bats a player has. You will...
Questions
question
Mathematics, 28.09.2019 10:00
question
English, 28.09.2019 10:00
question
Health, 28.09.2019 10:00
Questions on the website: 13722367