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
NEED HELP FAST timed
Andrej [43]

ton

Answer:

piston - engine book

values- crackshaft rod

head- camshaft

3 0
3 years ago
Discuss how the user-designer communications gap can cause a good project to go bad.
Mila [183]
This gap between user-designer communications <span>can cause a good project to go bad i</span>f the user is not able to process what is required to be fixed in order for the project to run smoothly. The user may have one way of fixing something while the designer has another. In this case, the designer understands how the project fully works while the user does not and this may end up compromising the whole project.

The law that “designers are not users” and “users are not designers” should always be followed.




3 0
3 years ago
Which one of the following items would you be most likely to keep in a database ?
DerKrebs [107]
C.) Payroll records. These are the most extensive and data-intensive.
8 0
3 years ago
Which one of the following pieces of information would be allowed as part of a limited data set?
Inessa05 [86]
Phone number would be allowed
6 0
3 years ago
Long distances are usually measured in kilometers.<br> T or F?
timama [110]
Depending where you are in the world it is true and false
7 0
3 years ago
Other questions:
  • Here's something to stop you from getting repetitive when writing essays. Write a program that reads multiple lines of plain tex
    15·1 answer
  • As you are researching RAM for a computer you are building that will be used as a home office server for his small business. The
    5·2 answers
  • Where do you go to create a workbook?​
    8·1 answer
  • You've been asked to find the largest number in a range of numbers. Which of the following could you use to find the largest num
    8·1 answer
  • While inspecting an element in the DOM on my website using the Chrome Devtools I accidentally deleted the DIV that had all my au
    8·1 answer
  • A school at which you are likely to be accepted because you meet graduation requirements is called a:
    5·1 answer
  • 6. Why did he choose to install the window not totally plumb?
    13·1 answer
  • A small company has hired you to take over its IT needs. The company currently has seven on-site employees and 12 remote employe
    12·1 answer
  • 12. When computer professionals take on jobs, they may not enter into relationships with which of the
    6·1 answer
  • What is the purpose of file extensions? A. They execute the mail merge function, B. They tell the operating system what kind of
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!