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
Write one line Linux command that performs the required action in each of the problems given below: (a) Find the difference in t
Luda [366]
You have to add the integer
8 0
3 years ago
The best time to visit a college is: A. during spring break. B. on a weekend. C. when the college is in session. D. during winte
GaryK [48]
When the college is in session
5 0
3 years ago
Read 2 more answers
Which of these devices is usually the default for most home network?
lora16 [44]

Answer:

there are no mutiple choices

5 0
4 years ago
Can someone help me with these questions on linear dimensions pls
andrew-mc [135]
Size dimentions reffer to overall dimentions and will tell the overall width, lenth height and depth of something location dimentions means the locatuon of each geometric shape.
7 0
3 years ago
Read 2 more answers
Which of the following is a job description for a person with a degree in Information Technology? radiology engineer web develop
Jet001 [13]

Answer: Web developer

Explanation: Web developer is a job where you have to develop World Wide Web applications by programming or applications that run over the internet, and this degree would need a degree in information technology

The other degrees needed for the following jobs:

1.    Radiology engineer: Radiology is a study of diagnosing and treating diseases with the help of medical imaging. So, it needs a degree in medical combined with physics and chemistry.

2.    Toxicologist broadcast technician: is a job where the technician has to determine the factors which contributed to a person’s death. So, a person should have a degree in medicine to become a toxicologist technician

6 0
3 years ago
Other questions:
  • Triangle O N M is cut by line segment L K. Line segment L K goes from side N O to side N M. The length of N L is x, the length o
    8·2 answers
  • Write a program that prints all the numbers from 0 to 6 except 3 and 6. Expected output: 0 1 2 4 5
    13·1 answer
  • Jack is writing a paragraph for a school assignment. He proofreads his paper and notices that he used the word, "then" many time
    15·2 answers
  • ________ are used to translate each source code instruction into the appropriate machine language instruction.
    11·1 answer
  • Which vendor did IBM select to create the operating system for the IBM PC?
    6·1 answer
  • Which port must be open on your router to allow you to upload device configuration and firmware updates using trivial file trans
    13·1 answer
  • is a measurement that quantifies how much information can be transmitted over the network. A. Memory B. DMZ C. Bandwidth D. Clou
    10·1 answer
  • k-means clustering cannot be used to perform hierarchical clustering as it requires k (number of clusters) as an input parameter
    15·1 answer
  • State the Limitations of the first generation of computers​
    8·1 answer
  • What causes the hidden node problem in a wireless local area network (wlan)?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!