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

(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...
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...
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...
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.
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...
Perform a horizontal analysis providing both the amount and percentage change. (Round Percentage answers to 1...
Perform a horizontal analysis providing both the amount and percentage change. (Round Percentage answers to 1 decimal place. Decreases should be indicated by a minus sign.) Year 2018 2017   Cash $ 278,860    $ 730,000      Accounts receivable 324,090    130,000      Inventory 715,680    630,000      Long-term assets 3,280,330    2,230,000         Total assets $ 4,598,960    $ 3,720,000   
calculate the percentage by mass of oxygen in the following compounds. C17H19NO3
calculate the percentage by mass of oxygen in the following compounds. C17H19NO3
main() module Display "Welcome to my Guess the number program!" while true display_menu() Get input if(option==1)...
main() module Display "Welcome to my Guess the number program!" while true display_menu() Get input if(option==1) user_guess() elif(option==2) computer_guess() else break user_guess() module random mynumber count=1 userGuesses=[] while True try Display "Guess a number between 1 and 10" Get guess while guess<1 or guess>10 Display "Guess a number between 1 and 10" Get guess except Display "numbers only" continue userGuesses.append(guess) if (guess<mynumber) Display "Too low" count=count+1 else if (guess>mynumber) Display "Too high" count=count+1 else if (guess==mynumber) Display "You guessed it...
Java Write a program to record the GPAs of a class and find the percentage of...
Java Write a program to record the GPAs of a class and find the percentage of students in each GPA. The program first allows the user to enter the number of students enrolled in the class, and then to enter the GPA of all students one by one. For each student, the input must be between 1 and 4 inclusively. Otherwise, the software displays a message as “Invalid number!” and asks for a new GPA for the same student Enter...
There are two methods to calculate the allowance. One is the percentage of sales method that...
There are two methods to calculate the allowance. One is the percentage of sales method that determines the amount based on multiplying the expected percentage of uncollectibles by the net credit sales. There is also the aging of receivables method. Can you tell me what that is?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT