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
Here is the list of problems to choose from:
olya-2409 [2.1K]

Answer:

There's a parking lot that is 600m² big. The lot must be able to hold at least 3 buses and 10 cars.

Each car takes up 6m² and each bus takes up 30m².

However, there can only be 60 vehicles in the lot at any given time.

The cost to park in the lot is $2.50 per day for cars and $7.50 per day for buses. The lot must make at least $75 each day to break even.

What is a possible car to bus ratio that would allow the lot to make profit?

3 0
2 years ago
Which of the following shows the assignment of a string to a variable? Select 3 options.
satela [25.4K]

Answer:

23, (23)

Explanation:

7 0
2 years ago
Read 2 more answers
Which slide elements must Claire use to enhance her presentation?
Alja [10]
She needs to use animations to enhance her presentation
8 0
2 years ago
Which troubleshooting tool enables you to connect to a user's remote computer, view and interact with the user's screen, and cha
DaniilM [7]
That would be Remote assistance.
6 0
3 years ago
Whats included in ms office 2013 professional?
MrMuchimi
Powerpoint, word document, and excel
3 0
3 years ago
Other questions:
  • When saving a memo you created in Word, which one of the following extensions is automatically assigned to the document?
    13·1 answer
  • Which partitioning method must you use for a 4-tb hard drive?
    13·1 answer
  • Tab stops are very useful when you want to A. align text into rows. B. add space between paragraphs. C. align text into columns.
    14·2 answers
  • The box formed by the intersection of a row and column in a spreadsheet program is known as a ________.
    13·1 answer
  • A user's computer will not boot. A technician notices four indicator lights on the backside of the
    8·1 answer
  • Which do switches create?<br> Networks<br> Wireless access points<br> Routes<br> Collision domains
    13·1 answer
  • Which shortcut key combination will move the cursor to the beginning of the line?
    13·1 answer
  • An argument does not always have to be made in words. A piece of music
    12·1 answer
  • Consider the relational schema below: Students(sid: integer, sname: string, major: string) Courses(cid: integer, cname: string,
    9·1 answer
  • if we try to use tail-recursive rules to implement non-tail-recursive rules, it will normally result in rules that are
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!