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 a program that asks the user for the name of a text file. the program should display the last 10 lines of the file on the
Tom [10]
The only thing that I know is that after you input the text file, it could either:
-save those lines as a variable
-display the text file
However any more would be dependent on the language.
3 0
3 years ago
What is the computer’s natural language?
kirill [66]

Answer:

binary computer natural language

4 0
3 years ago
What is the function of Cascading Style Sheets?
Kaylis [27]

Answer:

answer is c

Explanation:

no need for explaination

8 0
3 years ago
HAY ALGUEN QUE ASE PARN4 CON UN PUTO ÑIÑO
tamaranim1 [39]
Hshahbwhwjqqjkqjajwkkw
6 0
3 years ago
When is it appropriate to delete an entire row or column as opposed to deleting the data in the row or column
borishaifa [10]

Answer:

huh wdym

Explanation:

7 0
3 years ago
Other questions:
  • A thick black line around the outside edge of a page is a _____.
    6·2 answers
  • You're creating a table for one of your slides, and need to make some modifications to your table structure. Which of the follow
    14·1 answer
  • What is a GUI?
    11·1 answer
  • Define algorithm<br> Write a small algorithm
    15·2 answers
  • Alison is having a hard time at work because her Inbox is flooded with emails every day. Some of these emails are unsolicited. S
    15·2 answers
  • What is computer generation.<br>name that generations ​
    9·2 answers
  • FFFFFFFFFRRRRRRRRRRRRRRRRRREEEEEEEEEEEEEEEEEEEEEEE
    10·2 answers
  • If you created a variable called name, what data type would that value be? Group of answer choices a float a string a Boolean an
    5·2 answers
  • What software application is most appropriate to use to create multimedia presentations?
    6·2 answers
  • Hi. I'm a beginner in python. Can anyone tell me what I'm missing or doing wrong, because I can't figure out why my messages in
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!