Main topics: Basic Java program
Programmatic output
Arithmetic Expressions
User input
Program Specification:
Write a Java program that calculates and outputs a baseball pitcher’s ERA in a reasonable report format. "ERA" is an acronym for "earned run average" and is computed using the following equation: number of earned runs multiplied by 9 and divided by number of innings pitched Your program must do the following: • Prompt the user for the first and last name of the pitcher and store them in two variables of type String • Prompt the user for the pitcher’s number of earned runs and store it in a variable of type int • Prompt the user for the pitcher’s number of innings pitched and store it in a variable of type int • Compute and output the pitcher’s ERA, which should be a (double) floating point number Sample run(s): Pitcher’s first name: Josh Pitcher’s last name: Hader Number of earned runs: 22 Number of innings pitched: 81 Josh Hader has an ERA of 2.4444444444444446

Answers

Answer 1

Answer:

Explanation:

import java.util.Scanner;

public class pitcherValues {

   public static void main(String[] args) {

       String firstName, lastName;

       int earnedRuns, inningsPitched;

       double ERA;

      Scanner in = new Scanner(System.in);

     System.out.println("Pitchers First Name is?");

     firstName = in.nextLine();

     System.out.println("Pitchers Last Name is?");

     lastName = in.nextLine();

     System.out.println("How many runs did the Pitcher earn?");

     earnedRuns = in.nextInt();

     System.out.println("How many innings did the Pitcher Pitch?");

     inningsPitched = in.nextInt();

     ERA = (earnedRuns * 9) / inningsPitched;

     System.out.println(firstName + " " + lastName + " has an ERA of " + ERA);

   }

}


Related Questions

help me plzz thank you if your right I will mark brainiest

Answers

Answer:

the 1,2, and 3 are the second circle thingy and the fourth question is the first circle thing and dont know the last one hope this helps

Explanation:

Answer in this order.
B, B, B, B, A. I’m 80% sure these are the right answers.

what is Service Operations in ITIL​

Answers

Explanation:

the objective of ITIL service operations is to make sure that IT services are delivered effectively and efficiently. the service operation life cycle stage includes the fulfilling of user requests, resolving service failure fixing problems and also carrying out routine operational tasks

How many components does a network have ?

Answers

Answer:

There are three primary components to understanding networks: 1. Physical Connections; 2. Network Operating System; and 3. Application Component. Hope this helps!

Explanation:

James uses a database to track his school's football team. Which feature in a database allows James to find a specific player by name?

Grid
Filter
Search
Sort

Answers

Search if he knows the players name

Answer:

search

Explanation:

Create an interface called Runner. The interface has an abstract method called run() that displays a message describing the meaning of run to the class. Create classes called Machine, Athlete, and PoliticalCandidate that all implement Runner.
The run() should print the following in each class:
Machine - When a machine is running, it is operating.
Athlete - An athlete might run in a race, or in a game like soccer.
PoliticalCandidate - A political candidate runs for office.
----------------------------------------------------------------------------------------------------
public class Athlete implements Runner
{
public void run()
{
// write your code here
}
}
--------------------------------------------------------------------------------------
public class DemoRunners
{
public static void main(String[] args)
{
Machine runner1 = new Machine();
Athlete runner2 = new Athlete();
PoliticalCandidate runner3 = new PoliticalCandidate();
runner1.run();
runner2.run();
runner3.run();
}
}
------------------------------------------------------------------------------------------
public class Machine implements Runner
{
public void run()
{
// write your code here
}
}
----------------------------------------------------------------------------------------------------
public class PoliticalCandidate implements Runner
{
public void run()
{
// write your code here
}
}
----------------------------------------------------------------------------------------------------
public interface Runner
{
// write your code here
}
----------------------------------------------------------------------------------------------------

Answers

Answer:

Here is the interface Runner:

public interface Runner  {  //interface Runner

public abstract void run();  } //abstract method run that displays a message describing the meaning of run to the class

/*Here Runner is the interface which is an abstract class. It is used to group related methods such as here is run method with empty body. An abstract method run() does not have a body. The body is provided by the sub classes Machine, Athlete, and PoliticalCandidate that all implement Runner.  */

Explanation:

Here is the Athlete class:

public class Athlete implements Runner  {  //class that implements Runner interface

public void run()  {  //interface method accessed by Athlete to provide its body according to describe the meaning of run to the class

    System.out.println("An athlete might run in a race, or in a game like soccer.");  } }    //prints this message

Here is the Machine class:

public class Machine implements Runner  {

public void run()  {

System.out.println("When a machine is running, it is operating.");  }}

Here is the PoliticalCandidate class:

public class PoliticalCandidate implements Runner  {

public void run()  {

System.out.println("A political candidate runs for office.");  } }

/*To access the interface Runner method run(), the Runner must be "implemented" by Machine, Athlete, and PoliticalCandidate classes with the implements keyword. The body of the interface method run() is provided by the "implement" class */      

Here is the DemoRunners class:

public class DemoRunners {  //class name

public static void main(String[] args)  {  //start of main method

Machine runner1 = new Machine();  //creates object of Machine class

Athlete runner2 = new Athlete();  //creates object of Athlete class

PoliticalCandidate runner3 = new PoliticalCandidate();  //creates object of PoliticalCandidate class

runner1.run();  //uses object of Machine class to call run method

runner2.run();  //uses object of Athlete class to call run method

runner3.run();  } } //uses object of PoliticalCandidate class to call run method

When runner1.run() is called it invokes the run() method of class Machine which displays the message:

When a machine is running, it is operating.

When runner2.run() is called it invokes the run() method of class Athlete which displays the message:

An athlete might run in a race, or in a game like soccer.  

When runner3.run() is called it invokes the run() method of class PoliticalCandidate which displays the message:

A political candidate runs for office.

The screenshot of the program is attached.

The two statements belowchar dance1[ ] = {'F','o','x','t','r','o','t'};String dance2 = new String(dance1);will generate an error message:

a. because char variables and String variable do not mix.
b. will generate an error message because char variables and String variable do not mix.
c. show that a String variable, like dance2, is an array.
d. demonstrate that a character array can be used to construct a String object.
e. prove that character variables and String variables are identical.

Answers

Answer:

D. Demonstrate that a character array can be used to construct a String object.

Explanation:

Option D answers the question.

This is so because:

The first line of the code segment creates a char array element i.e. dance1

The second line of the code segment creates a String variable, dance2.

dance2 is then initialised by concatenating the elements in dance1.

i.e. The value of dance2 is

dance2 = "Foxtrot"

Hence, option D answers the question

A have a string, called "joshs_diary", that is huge (there was a lot of drama in middle school). But I don't want every one to know that this string is my diary. However, I also don't want to make copies of it (because my computer doesn't have enough memory). Which of the following lines will let me access this string via a new name, but without making any copies?

a. std::string book = joshs_diary;
b. std::string & book = joshs_diary; const
c. std::string * book = &joshs_diary;
d. std::string book(joshs_diary);
e. const std::string & book = joshs_diary;
f. const std::string * const book = &joshs_diary;
g. std::string * book = &joshs_diary;

Answers

Answer:

C and G

Explanation:

In C language, the asterisks, ' * ', and the ampersand, ' & ', are used to create pointers and references to pointers respectively. The asterisks are used with unique identifiers to declare a pointer to a variable location in memory, while the ampersand is always placed before a variable name as an r_value to the pointer declared.

Other Questions
for the graph of g(x) pictured below, over which of the following intervals is g(x) only decreasing? what is Service Operations in ITIL can some one answer the question please i will make you Brainliest if you get the correct answer Where did most slaves comefrom in the colonies? answer for immediate brainliest!!! The Aryans greatly influenced Indian civilization by doing which of the following? (1 point)Question 20 options:1) outlawing the practice of religion2) destroying the Sanskrit language3) creating the caste system4) building Mohenjo-Daro How much did it cost to see the Marx Brothers live on Broadway in the 1920s? A processor makes two components, A and B, which are then packaged together as the final product (each product sold contains one A and one B). The processor can do only one component at a time: either it can make As or it can make Bs. There is a setup time when switching from A to B. Current plans are to make 100 units of component A, then 100 units of component B, then 100 units of component A, then 100 units of component B, and so forth, where the setup and run times for each component are given below. COMPONENT SETUP/CHANGEOVER TIME RUN TIME/UNIT A 5 minutes 0.2 minute B 10 minutes 0.1 minute Assume the packaging of the two components is totally automated and takes only two seconds per unit of the final product. This packaging time is small enough that you can ignore it. Require:What is the average hourly output, in terms of the number of units of packaged product (which includes one component A and one component B)? Which of the following is not a process that occurs during cytokinesis of an animal cell?(Please help I will mark brainliest)A. Cytoplasm is dividedB. Nucleus reappearsC. Chromosomes line up at the metaphase plateD. Nuclear envelope surrounds chromosomes With as much as detail as possible, give another example of an analogy for describing the difference between prokaryotic cells and eukaryotic cells Which of the following describes the extent to which many families with Deaf children learn ASL?1. many families with Deaf children become so inspired by learning ASL that they become professional interpreters2. many families with Deaf children learn some ASL but then hire a tutor when their child is of school age to supplementASL education3. many families with Deaf children must be fluent in ASL because they need to start teaching their children ASL assoon as possible4. some families with Deaf children become fluent in ASL, but many do not The circle shown has a radius of 12 mm. What is the circumference of the circle? PLEASE PLEASE HELP I NEED THIS RIGHT NOW Which sentence uses superfluous correctly?A. The water started flowing from the new sprinkler system in a superfluous way. B. The water was supefluous to the runners after the marathon.C. After the power came back on, the use of flashlights was superfluous. D. The new instructor found the class to be superfluous and attentive. After referring to the text, describe the significance of this warrior being depicted on horseback. Please help me out! Multiply. Do not round your answer.2.48x8.62 =? Mechanistic vs. Organic Structures Managers taking a contingency approach must consider numerous factors in designing the best kind of structure for their particular organization at that particular time. British behaviorists Tom Burns and G.M. Stalker identified what they call mechanistic and organic structures. Depending on the task environment and a variety of other considerations, the type of organizational structure chosen can be critical to organizational success. This exercise will test your knowledge of the characteristics of each of these types of organizational structure.Select the most appropriate category (mechanistic or organic structure) for each of the characteristics of organizations. 1. Few rules and procedures 2. Narrow span of control 3. Specialized tasks 4. Many teams or task forces5. Many rules and procedures 6. Decentralized hierarchy of authority 7. Flatter structure 8. Informal communication 9. Taller structure 10. Centralized hierarchy of authority 11. Wider span of control 12. Shared tasks 13. Formalized communication 14. Few teams or task forces Category:a. Mechanistic Organizations b. Organic Organizations A boat costs $15.500 and decreases in value by10% per year. How much will the beat be worthafter 5 years? What is the slope of a line that is parallel to the line joining (7,-5) and (-5,7) An objects volume is 0.12 kL. What is its volume in liters?