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
podryga [215]
3 years ago
10

Write a program that takes two ints as input from the keyboard, representing the number of hits and the number of at bats for a

batter. Then calculate the batter’s hitting percentage and check if the hitting percentage is above .300. If it is, output that the player is eligible for the All Stars Game; otherwise, output that the player is not eligible. Maintain floating point precision when calculating the hitting percentage
Computers and Technology
1 answer:
Ludmilka [50]3 years ago
5 0

Answer:

#include <iostream>

using namespace std;

int main() {

int nhits,nbats;//declaring number of hits and number of bats..

cin>>nhits>>nbats;//promting nhits and nbats..

float perc=(float(nhits)/nbats)*100;//calculating percentage..

if(perc>300)//checking eligibility.

{

   cout<<"Eligible for ALL STARS GAME"<<endl;

}

else

cout<<"NOT Eligible"<<endl;

return 0;

}

Output:-

55

7

Eligible for ALL STARS GAME.

Explanation:

I have taken two integer variables nhits and nbats for number of hits and number of bats.Prompting them from the user.After that i am calculating the percentage and it needs to be a float variable.So I have done typecasting for the that converting 1 integer to float so that the answer will come in float.After that checking the eligibility and printing the message.

You might be interested in
‘‘Anyone in the developed world can publish anything anytime, and the instant it is published, it is globally available and read
taurus [48]
The internet made huge changes to the way news and information were shared. While it was faster to use newspapers or magazines to spread information than it was to simply tell people, they were still very inefficient compared to today's technology. With the internet today, anyone can come online and learn about what's happening in the far corners of the world. Take your question, for instance. If there was no internet, you might have to post a notice somewhere, which could take days to answer. However, since you were able to post this on the internet, I'm able to answer it within five minutes of it being posted.
8 0
3 years ago
We piped the results of the Get-Process cmdlet to the Sort-Object cmdlet to sort them in descending order. Which property was us
Basile [38]
The answer is yes hope this helps did before
5 0
3 years ago
The values of the member variables of objectOne are being copied into the corresponding member variables of objectThree. This in
djyliett [7]

Answer:

member wise Initialization.

Explanation:

Member wise initialization is used for the following cases:-

  1. When you have constant member in your class.
  2. When you have Reference member in your class.
  3. When you have a very large member in your class.
  4. When you have a member with no default constructor.

Member wise initialization is uses initialization and the direct initialization uses assignment.

8 0
4 years ago
Write a java program to create and display unique three digit number using 1,2,3 and 4 also count how many three digit number ar
padilas [110]

Answer:

Answered below

Explanation:

Class Unique{

public static void main(String args[]){

int myArray[] = {1, 2, 3, 4};

int newArray[];

int i;. int j; int k;

for(i = 0; i < myArray.length; I++)

for(j = 0; j< myArray.length; j++)

for(k = 0; k< myArray.length; k++){

if(i != j && j!= k && i != k ){

newArray.add(myArray[i] + myArray[j] + myArray[k]);

}

}

int count = 0;

for(int m = 0; m < newArray.length; m++){

count++;

}

System.out.print(newArray, count)

}

}

5 0
3 years ago
When Hallmark designs its website so that a teenage girl can send a theme card to her boyfriend's cell phone, what is the primar
padilas [110]

Answer:

Hallmark is using the Age segmenting dimension.

Explanation:

Most businesses and organizations tend to understand their customers, that is, their behaviors on purchases.

There are 7 important ways businesses segment their customers. They are:

  1. Income
  2. Age
  3. Gender
  4. Acquisition Path
  5. First purchase
  6. Geography
  7. Device type

In our scenario, Hallmark is using the Age segmenting dimension because they can identify that its a teenage girl that is sending theme card to her boyfriend's cell phone.

7 0
3 years ago
Other questions:
  • Refer to the exhibit. pc1 issues an arp request because it needs to send a packet to pc3. in this scenario, what will happen nex
    9·1 answer
  • ____ is a website that checks a submitted paper and then determines how much of the paper is unoriginal.
    12·1 answer
  • What should be included in research for a problem statement? Select all that apply
    13·2 answers
  • Which of the following is another type of brake system used in trucks
    5·1 answer
  • You receive an email from a woman claiming her father was poisoned by business associates, but before his passing placed 12 mill
    12·2 answers
  • How many triangles can you make if the side lengths are 4 cm, 5 cm, and 11 cm?
    10·1 answer
  • Why is making a model, or prototype, important in the design process?
    6·1 answer
  • What is a computer ?​
    12·2 answers
  • The information of an management information system comes from?
    14·1 answer
  • To track what level a player is on, you can create a simple variable and a block saying change level by 1 attached to the when g
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!