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
How do you render and export files on blender
Debora [2.8K]

Answer:

Save your Blender file (. blend) in the same folder as your . obj file, if you didn't already.

Click on File/External Data/Pack All into . blend.

Click on File/External Data/Unpack All Into Files.

Choose "Use files in current directory (create when necessary)"

Explanation:

<em>Hope </em><em>it </em><em>helps </em><em>ya </em><em>ItzAlex</em>

6 0
3 years ago
Find the area of square whose perimeter is 260.8m​
inessss [21]
4251.04

The perimeter (260.8) over 4 is equal to each side length (65.2)

65.2^2 = 4251.04
5 0
2 years ago
Which of the following should be clicked to open Backstage View?
lora16 [44]

Answer:

File tab

Explanation:

source https://www.computerhope.com/jargon/b/backstage-view.htm

7 0
2 years ago
Read 2 more answers
A network administrator has statically configured the LMI type on the interface of a Cisco router that is running Cisco IOS Rele
Sergeu [11.5K]

Answer:

The answer is "The LMI model should be compatible with the supplier dynamically for the network manager".

Explanation:

The term LMI stands for the "Local Management Interface", it is a Cisco technology, in which the signaling protocol was used in between routers and transmission frame switches to share data in timekeepers, global addressing, multipathing as well as the present state of virtual socks for various purposes, in which it is mainly used for "dynamically setting, in which the network administrator provides compatibility with the service provider".

8 0
3 years ago
The insertion sort algorithm sorts using what technique?
QveST [7]

Answer:

Iteration

Explanation:

The insertion sort is based on repetition of comparing one data array (or element in a list) with the others at its left to reorganize it, normally following a size criteria (from small to big or the other way around).

At each iteration, the algorithm takes one element and compares it one by one to the others until it fit the specified criteria. Later on, it creates a space, moving the other elements, to insert it. Later, it  goes to the next element and the iteration repeats all the way through. It has some advantages over other sorting algorithms because it is easy to deploy and program it in many different languages, but at the same time it can be terribly slow when sorting large amount of data.

7 0
2 years ago
Other questions:
  • Dial-up connections can be made over a(n) ____ line or phone line. isdn dsl ipx tcp/ip
    12·1 answer
  • A client accessing a network share folder has authenticated into the system and has full access rights to a folder share. But af
    11·1 answer
  • This information is generally included on a fax cover sheet.
    15·1 answer
  • . String literals are surrounded by _____ quotes
    14·1 answer
  • What is data security
    14·1 answer
  • ) How many switching functions of two variables (x and y) are there?
    11·1 answer
  • Whic flag has a special role in debuging
    6·1 answer
  • What is a protein called if it loses its shape?
    8·1 answer
  • You make an online purchase of a hooded sweatshirt with the logo of the Dallas Cowboys. The next time you log on, your screen ha
    9·1 answer
  • How do you stop getting emails from brainly saying "sarah from brainly has answered your question"
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!