Question

In: Computer Science

Welcome to the Bruins Goalie Saves Analysis This program will calculate the percentage of saves for...

Welcome to the Bruins Goalie Saves Analysis This program will calculate the percentage of saves for a hockey goalie for 4 games after you have entered the games and saves for the goalie. Enter the number of goals for game #1: 3 Enter the number of saves for game #1: 22 The percent saves for game #1 is 88.0% Enter the number of goals for game #2: 4 Enter the number of saves for game #2: 33 The percent saves for game #2 is 89.2% Enter the number of goals for game #3: 1 Enter the number of saves for game #3: 16 The percent saves for game #3 is 94.1% Enter the number of goals for game #4: 0 Enter the number of saves for game #4: 22 The percent saves for game #4 is 100.0% The percent saves for 4 games for this goalie is 92.1% Thanks for using the Bruins Goalie Saves Analysis program.

Solutions

Expert Solution

Here is the C program for the above task:

#include <stdio.h>

int main() {

    //print initial message on the console

    printf("Welcome to the Goalie Saves Analysis\n");

    printf("This program will calculate the percentage of saves for a hockey goalie for 4 games after you have entered the games and saves for the goalie\n");

    //loop four times

    int i;

    for(i = 1; i <= 4; ++i) {

        int goals, saves; //variables to store number of goals and saves

        //input goals

        printf("\nEnter the number of goals for game #%d: ", i);

        scanf("%d", &goals);

        //input saves

        printf("Enter the number of saves for game #%d: ", i);

        scanf("%d", &saves);

        //calculate saves percent and print to screen upto 1 decimal place

        float percent = ((float)saves / (goals + saves)) * 100;

        printf("Enter the number of goals for game #%d: %.1f%%\n", i, percent);

    }

    printf("\nThanks for using the Bruins Goalie Saves Analysis program.\n");

    return 0;

}


Sample IO:


Related Solutions

Write a C program that calculates the percent saves for a hockey goalie for 4 games...
Write a C program that calculates the percent saves for a hockey goalie for 4 games and the overall percentage of saves which is saves divided by the sum of goals plus saves. input->process->output->repeat The program should prompt the user to enter the number of goals and the number of saves for each of the 4 games. The program should then calculate and display the percent saves obtained for each game. Once processing is complete for the games, the program...
(CODE IN PYTHON) Program Input: Your program will display a welcome message to the user and...
(CODE IN PYTHON) Program Input: Your program will display a welcome message to the user and a menu of options for the user to choose from. Welcome to the Email Analyzer program. Please choose from the following options: Upload text data Find by Receiver Download statistics Exit the program Program Options Option 1: Upload Text Data If the user chooses this option, the program will Prompt the user for the file that contains the data. Read in the records in...
Calculate Interest in a Java program. If you know the balance and the annual percentage interest...
Calculate Interest in a Java program. If you know the balance and the annual percentage interest rate, you can compute the interest on the next monthly payment using the following formula: interest = balance * (annualInterestRate/1200) Write a program that reads the balance and the annual percentage interest rate and displays the interest for the next month. Create a scanner Prompt the user to enter a name and create variable for scanner Prompt the user to enter a balance and...
in java write a program that initializes a String variable with "Welcome to Jac444!". Then, use...
in java write a program that initializes a String variable with "Welcome to Jac444!". Then, use methods of the String class to examine the string and output a few properties of the string, namely The string by itself The length of the string The first character in the string The last character in the string The first word of the string The last word of the string Make sure that your output also contains how many words exists in the...
Create a program that: Creates a sales receipt, displays the receipt entries and totals, and saves...
Create a program that: Creates a sales receipt, displays the receipt entries and totals, and saves the receipt entries to a file Prompt the user to enter the Item Name Item Quantity Item Price Display the item name, the quantity, and item price, and the extended price (Item Quantity multiplied by Item Price) after the entry is made Save the item name, quantity, item price, and extended price to a file When you create the file, prompt the user for...
Program must use Python 3 Your program must have a welcome message for the user. Your...
Program must use Python 3 Your program must have a welcome message for the user. Your program must have one class called CashRegister. Your program will have an instance method called addItem which takes one parameter for price. The method should also keep track of the number of items in your cart. Your program should have two getter methods. getTotal – returns totalPrice getCount – returns the itemCount of the cart Your program must create an instance of the CashRegister...
PYTHON program that: Asks for a name, and then displays "Welcome student" plus your name on...
PYTHON program that: Asks for a name, and then displays "Welcome student" plus your name on the screen. (concatenate your name after the string) and prompts the user for 2 numbers, then calculates and displays the sum, product and average.
Write the program WritePatientRecords that allows a doctor’s staff to enter data about patients and saves...
Write the program WritePatientRecords that allows a doctor’s staff to enter data about patients and saves the data to a file called Patients.txt. The output should be in the following format: p#, PATIENT_NAME, BALANCE. Create a Patient class that contains fields for ID number, name, and current balance owed to the doctor’s office. using System; using static System.Console; using System.IO; class WritePatientRecords { static void Main() { // Your code here } }
Using Python, write a program named hw3b.py that meets the following requirements: Welcome the user to...
Using Python, write a program named hw3b.py that meets the following requirements: Welcome the user to Zion's Pizza Restaurant and ask the user how many people are in their dinner group. If the answer is more than eight (8), print a message saying they'll have to wait for a table. Otherwise, report that their table is ready and take their order. Assume the client orders one pizza, and ask what he/she would like on their pizza, include a loop that...
Trend Analysis & Ratio Analysis Ratio analysis uses percentage or decimal calculations of comparison to at...
Trend Analysis & Ratio Analysis Ratio analysis uses percentage or decimal calculations of comparison to at least two different sets of financial data using two industries. Comparing how one relates (compares) to another. Be sure to provide website
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT