1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Yakvenalex [24]
3 years ago
13

The BaseballPlayer class stores the number of hits and the number of at-bats a player has. You will complete this class by writi

ng 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; } }
Computers and Technology
1 answer:
atroni [7]3 years ago
7 0

Answer:

class BaseballPlayer {

 private int hits;

 private int atBats;

 private String name;

 public BaseballPlayer(String n,int h,int a) {

   name=n;

   hits=h;

   atBats=a;

 }

 public void printBattingAverage() {

   double battingAverage = hits / (double)atBats;

   System.out.println(battingAverage);

 }

 public String toString() {

   return name + ": "+hits+"/"+atBats;

 }

}

public class Baseballtester{

 public static void main(String[] args){

   BaseballPlayer babeRuth = new BaseballPlayer("Babe Ruth", 2873, 8399);

   System.out.println(babeRuth);

   babeRuth.printBattlingAverage();

 }

}

Explanation:

The BaseballPlayer class is used to get and hold data of an instance of a baseball player. the instance object holds the name, number of hits and bats of the player.

The constructor is used to initialize the name, hits and atBats variables of an instance. The "printBattlingAverage" method returns the ratio of the hits and atBat variable while the string method "toString" returns the name and the hits to atBats ratio in string format.

You might be interested in
Explain the information processing cycle and give examples
strojnjashka [21]
Information processing cycle - Computer Definition. The sequence of events in processing information, which includes (1) input, (2) processing, (3) storage and (4) output. The input stage can be further broken down into acquisition, data entry and validation.

That's all I got. Hope that helped a little (:
5 0
4 years ago
Adobe Acrobat reader is free. Adobe does this to build a market for the sale of software that creates Acrobat files. This is an
Evgesh-ka [11]

Answer:

The correct option to the following question is an option (D).

Explanation:

The latest version of the Adobe Acrobat reader is Adobe Acrobat Reader DC which is the best pdf reader or viewer and this software is available free on the website of the acrobat with license.

Adobe Acrobat reader is only used in reade and view the pdf file if we want to edit those file then we have to purchase them.

6 0
3 years ago
Which best defines what a script tag does?
lozanna [386]

Answer:

The answer to your question would be C , A tag used to write programming scripts.

Explanation:

The  element either contains scripting statements, or it points to an external script file through the src attribute. Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content. Hope this helps you! </p><p></p>

5 0
3 years ago
Program documentation _____. Group of answer choices describes the inputs, outputs, and processing logic for all program modules
valentinak56 [21]

Answer:

In the given question the first line is correct, i.e. "Describes the inputs, outputs, and processing logic for all program modules".  

Explanation:

The documentation is a recorded text or image, which is preceding or in the code base of the programs, whether it describes how well the program works and how it is being used, and things in various positions can be influenced by people, and the wrong option can be described as follows:

  • In the documentation, it can't consist of rules and data.
  • In can't include a dictionary, flow maps, screen designs and device requests that began the program.
  • In can't provide links within the program.
6 0
4 years ago
Need the answer ASAP!!!!
DENIUS [597]

Answer:

its Boolean

Explanation:

trust me

4 0
3 years ago
Other questions:
  • Why is the show "Insatiable so awesome?
    12·2 answers
  • Consider the following relation: CAR_SALE (Car#, Date_sold, Salesman#, Commision%, Discount_amt Assume that a car may be sold by
    15·1 answer
  • If the pc-doctor software is installed on a computer's hard drive, what two different ways can the program be started?
    9·1 answer
  • If your laptop is not able to connect to your wireless network, which of the following might be a likely cause of the problem?
    11·2 answers
  • What can Strings store
    15·2 answers
  • What is the name of a button on a website?
    11·1 answer
  • A firm has a huge amount of individual customer data saved in different databases. Which of the following can be used to integra
    11·1 answer
  • I really need help with this question
    14·1 answer
  • What will you see on the next line?
    6·2 answers
  • Can i get some help please .
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!