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...
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...
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.
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...
Instructions from your teacher: Write a Python program that does the following: Displays a welcome message...
Instructions from your teacher: Write a Python program that does the following: Displays a welcome message Prompts a user to enter a number (an integer), and then converts that value from inches to feet. If the user entered a negative number, display an error message telling the user that it was not a "positive " number and prompt the user to enter a number again. Displays the converted value, then " feet" Continue converting the user's valid values until the...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT