Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overview For this assignment, write a program to calculate the shooting percentage for a team in the National Hockey League. This program will be used

Overview

For this assignment, write a program to calculate the shooting percentage for a team in the National Hockey League. This program will be used as a starting point for the next couple of assignments so it is important that it is completed and completed correctly.

As with program 1, this program will also start by asking the user to enter some information. For this assignment, ask the user for the number of goals that were scored and save that value in a variable. This variable should be an integer.

Now prompt the user to enter the number of shots that were attempted and save that value in a variable. Just like with the goals scored, this variable's data type should also be integer.

After all of the information has been entered, calculate the team's Shooting Percentage using the following formula:

Shooting Percentage = number of goals that were scored / number of shots that were attempted * 100 

The variable that holds the calculated shooting percentage (if one is used) should be data type float or double. Note: keep in mind that the use of integer variables means that the formula has integer division and that will need to be taken into consideration in order to get the correct result.

Finally, display the calculated Shooting Percentage with exactly 1 digit after the decimal point.

Program Requirements

At the top of your C++ source code, include a documentation box that resembles the one from program 1. Make sure the Date Due and Purpose are updated to reflect the current program.

Include line documentation. There is no need to document every single line, but logical "chunks" of code should be preceded by a line or two that describes what the "chunk" of code does. This will be a part of every program that is submitted for the remainder of the semester.

The number of goals scored and the number of shot attempts should be data type integer. The calculated shooting percentage should be type float or double. Make sure to use meaningful variable names.

As mentioned above, the shooting percentage should be displayed with exactly 1 digit after the decimal point.

Make sure and test your program with values that you have calculated.

Hand in a copy of your source code using Blackboard.

Output

A few runs of the program should produce the following results:

Run 1

Enter the number of goals that were scored: 2 Enter the number of shots that were attempted: 49 The Shooting Percentage is 4.1 

Run 2

Enter the number of goals that were scored: 7 Enter the number of shots that were attempted: 32 The Shooting Percentage is 21.9 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Datalog Engines In Databases

Authors: Bas Ketsman ,Paraschos Koutris

1st Edition

1638280428, 978-1638280422

More Books

Students also viewed these Databases questions