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
A(n) ____ is a program that you use to create simple text files.
tatiyna

A <u>Text editor </u>is a program that you use to create simple text files.

<h3>What is the text editor?</h3>

A text editor is known to be a kind of a computer program that is known to give room for a user to be able to enter, alter , store, and also be able to print text (such as characters as well as numbers, each is known to be encoded by the computer as well as its input and output devices, set up to have meaning to a given users or to other kinds of programs).

Therefore, based on the above, one can say that A <u>Text editor </u>is a program that you use to create simple text files.

Learn more about Text editor from

brainly.com/question/4004088
#SPJ1

A(n) ____ is a program that you use to create simple text files. a. text editor b. IDE c. GUI d. GDE.

3 0
1 year ago
What is SoC? how is it different from CPU?
slamgirl [31]

Answer:

SoC usually contains a GPU

Explanation:

Where as a CPU cannot function without dozens of other chips

6 0
3 years ago
Discuss five processes for analyzing a qualitative study
xxMikexx [17]

1. Prepare and organize your data.

Print out your transcripts, gather your notes, documents, or other materials. Mark the source, any demographics you may have collected, or any other information that will help you analyze your data.

2. Review and explore the data.

This will require you to read your data, probably several times, to get a sense of what it contains. You may want to keep notes about your thoughts, ideas, or any questions you have.

3. Create initial codes.

Use highlighters, notes in the margins, sticky pads, concept maps, or anything else that helps you to connect with your data. See the attached document that demonstrates how one might highlight key words and phrases as well as make notes in the margins to categorize the data:

4. Review those codes and revise or combine into themes.

Identify recurring themes, language, opinions, and beliefs.

5. Present themes in a cohesive manner.

Consider your audience, the purpose of the study, and what content should be included to best tell the story of your data.

Hope this helped you!!!

4 0
3 years ago
Read 2 more answers
Explain why database management systems are used in hospitals? Discuss
Sergeeva-Olga [200]

The reason why database management systems are used in hospitals is because the use of Healthcare databases aids in terms of diagnosis and treatment, handle documentation and billing, and others.

<h3>What is a database management system in healthcare?</h3>

A database management system (DBMS) is known to be a type of software that has been developed to help people to form and keep databases.

It is one that helps to lower the risk of errors associated with medical operations and management. It reduces  paperwork and staff and also improves  performance.

Learn more about database management from

brainly.com/question/24027204

8 0
2 years ago
Before hard disk drives were available, computer information was stored on:
kobusy [5.1K]
Floppy disks . is the answer
6 0
3 years ago
Other questions:
  • How many electrons are there in an atom of carbon? A. Four B. Eight C. Six D. One
    15·2 answers
  • While recording a voice, if the narration is large,it is better to make a :a)a linked object b)an embedded object c)none d)does
    14·1 answer
  • When a pitcher is holding a baseball, the ball has ______energy.
    9·2 answers
  • Write only in C, not C++.
    14·1 answer
  • Shipments of compact digital cameras dropped by 42% due to the industry being unable to adjust to changes in the ________. a. ec
    11·1 answer
  • A company that provides finance services wants to shift to a mobile platform. What is the major advantage that the users of the
    15·2 answers
  • Who Has any idea How to code?
    7·2 answers
  • Hola buenas tardes, mi problema es el siguiente, en Word quiero alinear los párrafos por separado, pero, así lo sombree una line
    8·1 answer
  • POR FAVOR AYUDENME DIGAN SOLO 10 Ejemplos de Software de Sistema. SI NO REPRUEBO Y LE DOY CORONA
    14·2 answers
  • Activities provided for the satisfaction of others and consumed at the time of purchase<br> are…
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!