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
an error message is displayed during windws startup about a service that has failed to start, and then the system locks up. You
Tanzania [10]

Answer:

1:-Launch Windows RE and perform a Start Repair.

2:- Until you pick the Last Documented Successful Configuration on the Advanced Boot Options menu are the correct answer of this question.

Explanation:

Technology company Rescue is a Software restore tool capable of fixing some device issues that can prevent Microsoft for operating. Install Repair checks your Computer for the problem and then attempts to fix it, so that your Computer can start properly.

The Enhanced Boot Preferences app lets you connect to the internet in advanced mode for troubleshooting.

4 0
3 years ago
Hey how was your day 50 points
lakkis [162]

Answer:

bad

Explanation:

3 0
3 years ago
Read 2 more answers
A user cannot connect to any devices outside of the current network. Which device should a technician check first for problems?
tatiyna

Answer:

DHCP server

Explanation:

The first option that we must check is the DHCP server (The Dynamic Host Configuration Protocol) server because this is the protocol that gives us the IP addresses to connect with the internet if we don't have an IP (Internet Protocol) address,  we can never have an internet connection, if the DNS fails we cannot connect with the internet, but regularly the DHCP is the main issue if there are not physical issues.

4 0
3 years ago
~50 points~ <br> how do you merge shapes in powerpoint
mojhsa [17]

Answer:

Merge shapes

Select the shapes to merge. Press and hold Shift to select multiple shapes. The Shape Format tab appears. ...

On the Shape Format tab, click Merge Shapes, and then pick the option you want. The order in which you select the shapes to merge may affect the options shown to you.

Explanation:

5 0
3 years ago
Read 2 more answers
Polygon transform (25 points). Write a library of static methods that performs various geometric transforms on polygons. Mathema
kari74 [83]

Answer:

import java.lang.*;               //for using Math.cos() and Math.sin() and Math.toRadians() funcitons in rotate method

public class PolygonTransform

{

  public static double[] copy(double[] array)

  {

      double[] newArray = new double[array.length];

      for(int i=0;i<array.length;i++)

      {

          newArray[i] = array[i];

          return newArray;

      }

  }

  public static void scale(double[]x,double[]y,double alpha)

  {

      for(int i=0;i<x.length;i++)

      {

          x[i] *= alpha;

          y[i] *= alpha;

      }

  }

  public static void translate(double[]x,double[]y,double dx,double dy)

  {

      for(int i=0;i<x.length;i++)

      {

          x[i] += dx;

          y[i] += dy;

      }

  }

  public static void rotate(double[] x, double[]y,double theta)

  {

      double rad = Math.toRadians(theta);

      double temp;

      for(int i=0;i<x.length;i++)

      {

          temp = x[i];                           //For storing temporarily the previous value of x before changing so tha it can be used in changing y

          x[i] = x[i]*Math.cos(rad) - y[i]*Math.sin(rad);

          y[i] = y[i]*Math.cos(rad) + temp*Math.sin(rad);  

      }

  }

  public static void main(String args[])

  {

      //This is just implementing you testcase discripted.

      double[]x = new double[4];

      double[]y = new double[4];

      StdDraw.setScale(-5.0, +5.0);

      x = { 0, 1, 1, 0 };

      y = { 0, 0, 2, 1 };

      double alpha = 2.0;

      StdDraw.setPenColor(StdDraw.RED);

      StdDraw.polygon(x, y);

      scale(x, y, alpha);

      StdDraw.setPenColor(StdDraw.BLUE);

      StdDraw.polygon(x, y);

      // Translates polygon by (2, 1).

      StdDraw.setScale(-5.0, +5.0);

      x = { 0, 1, 1, 0 };

      y = { 0, 0, 2, 1 };

      double dx = 2.0, dy = 1.0;

      StdDraw.setPenColor(StdDraw.RED);

      StdDraw.polygon(x, y);

      translate(x, y, dx, dy);

      StdDraw.setPenColor(StdDraw.BLUE);

      StdDraw.polygon(x, y);

      // Rotates polygon 45 degrees.

      StdDraw.setScale(-5.0, +5.0);

      x = { 0, 1, 1, 0 };

      y = { 0, 0, 2, 1 };

      double theta = 45.0;

      StdDraw.setPenColor(StdDraw.RED);

      StdDraw.polygon(x, y);

      rotate(x, y, theta);

      StdDraw.setPenColor(StdDraw.BLUE);

      StdDraw.polygon(x, y);

  }

}

Explanation:

6 0
3 years ago
Other questions:
  • What are some options available when using the Replace feature?
    13·1 answer
  • What computer system was the first to run the unix operating system?
    11·1 answer
  • The ___ appears at the bottom of the windows desktop; it is used to launch and manage programs.
    15·1 answer
  • So I’m doing a PowerPoint of how social media changed my life any ideas what I should right down and what kind of topics should
    11·2 answers
  • What is 1/10 of 2.0 in decimal form​
    10·1 answer
  • Why is it important to evaluate the website on which you plan to shop?
    13·1 answer
  • How will you identify a file type on your computer?
    5·1 answer
  • Please help me with these two questions! 60 points!
    14·1 answer
  • Please name the OOP term that allows children classes to have methods with the same names as methods in their parents.
    10·1 answer
  • To optimize the flow of data into and out of the cpu, the modern mcc provides at least _______________ of data every time the cp
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!