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:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
The average cost of one year at a private college in 2012-2013 is $43,289. the average grant aid received by a student at a private college in 2012-2013 is $15,680.   what is the average student contribution for one year at a private college in 2012-2013?
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
Research data that is presented using descriptive language is said to be
Answers: 2
question
Computers and Technology, 23.06.2019 11:00
This chapter lists many ways in which becoming computer literate is beneficial. think about what your life will be like once you’re started in your career. what areas of computing will be most important for you to understand? how would an understanding of computer hardware and software you in working from home, working with groups in other countries and contributing your talents.
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, 10.06.2020 19:57
question
Mathematics, 10.06.2020 19:57
Questions on the website: 13722362