Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program to calculate a goals against average for a goalie in the National Hockey League. Basic Program Logic The first thing to

Write a C++ program to calculate a goals against average for a goalie in the National Hockey League. Basic Program Logic The first thing to do in the program is to create any variables that are needed to hold/save information for the program. To determine how many variables are needed, think about the information that will be entered by someone using the program and whether it is important for that information to be saved. Think about any calculations that will be performed by the program and whether the results of the calculations need to be saved. To determine the data type for the variables, think about what values someone using the program will be entering or what kind of results will be produced by any calculations. (Note: to ease into writing this first program, the data type for the variables has been specified below.) Ask the user of the program for the number of goals allowed. This is value should be saved in an integer variable. Ask the user of the program for the number of minutes played. This is value should be saved in a float or double variable. Use the two variables from above to calculate the goals against average, which is the number of goals allowed per 60 minutes played. Depending on how the code is written, if the calculated goals against average is saved in a variable, it should be type float or double. Goals Against Average = number of goals allowed * 60 / number of minutes played Finally, display the calculated goals against average with a label that indicates what the value represents.

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

Students also viewed these Databases questions