1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Free_Kalibri [48]
3 years ago
5

Golf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to ho

le and is called par (i.e. 3, 4, or 5). Each score's name is based on the actual strokes taken compared to par:
"Eagle": number of strokes is two less than par
"Birdie": number of strokes is one less than par
"Par": number of strokes equals par
"Bogey": number of strokes is one more than par

Given two integers that represent par and the number of strokes used, write a program that prints the appropriate score name. Print "Error" if par is not 3, 4, or 5.

Ex: If the input is:
4
3
Computers and Technology
1 answer:
Kobotan [32]3 years ago
7 0

The program is an illustration of if conditional statement. The programming language is not stated; so, I will answer the question using Python.

The program in Python where comments are used to explain each line is as follows:

<em>#This initializes the scores</em>

scores = ["Eagle","Birdle","Par","Bogey"]

<em>#This gets input for par</em>

par = int(input())

<em>#This gets input for stroke</em>

stroke = int(input())

<em>#This checks if par and stroke are between 3 and 5 (inclusive)</em>

if (par >=3 and par <= 5) or (stroke >=3 and stroke <= 5):

<em>#This calculates the difference between par and stroke</em>

   diff = stroke - par  + 2

<em>#This prints the corresponding score</em>

   print(scores[diff])

<em>#If par or stroke is out of range of 3 and 5</em>

else:

<em>#This prints error</em>

   print("Error")

<em>#At the end of the program, the appropriate score is printed.</em>

See attachment for the program source code and the sample run

Read more about python programs at:

brainly.com/question/16917190

You might be interested in
Write a loop that fills an array int values[10] with ten random numbers between 1 and 100. Write code for two nested loops that
zalisa [80]

Answer:

#include <iostream>

#include <cstdlib>

using namespace std;

int main() {

   int[] array = new int[10];

   int index = 0;

   while(index < array.size()){

           int number = (rand() % 100) + 1;

           for (int i = 0; i < 1; i++) {

               array[index] = number;

               cout<< "Position "<< index << "of the array = "<< number << endl;

               ++index;

           }

     }

}

Explanation:

The while loop in the source code loops over a set of code ten times, The for loop only loops once to add the generated random number between 1 and 100 to the array of size 10. At the end of the for loop, the index location and the item of the array is printed out on the screen. The random number is generated from the 'rand()' function of the C++ standard library.

7 0
2 years ago
What file name would allow you to easily find and edit your document later in Word Online?
DIA [1.3K]
The first one “ jane_essay 2_24_21 “
6 0
2 years ago
Read 2 more answers
_____ are the younger edge of gen y who have never lived without the internet or easy access to cell phones.
Sophie [7]

Generation Y are the people age 14-37, which means they are born 1977 - 2000.<span /><span>Tweens are the younger edge of gen Y who have never lived without the internet or easy access to cell phones.</span>
<span /><span>
</span>
8 0
3 years ago
What might happen if you haven't decided on a course of action when you're within 4-6 seconds of the intersection?
Delicious77 [7]
You Could Cause An Accident To Happen.
7 0
3 years ago
Consider the declaration of the struct houseType given in this chapter. Suppose firstHouse and secondHouse are variables of hous
Ilia_Sergeevich [38]

Answer:

See Explanation

Explanation:

The question is incomplete as there is no link pointing to the houseType struct of chapter 1.

So, I've answered the question from scratch

See attachment for explanation where I used comments to explain each line.

The program is as follows:

#include <iostream>

using namespace std;  

struct houseType{

   int firstHouse, secondHouse;

};

int main() {

   houseType hT;      

   cout << "Enter the price of both house: ";

   cin>> hT.firstHouse;

   cin>> hT.secondHouse;

   if(hT.firstHouse == hT.secondHouse){ cout<<"true";    }

   else{ cout<<"false";    }  

   return 0;

}

Download cpp
6 0
3 years ago
Other questions:
  • What coding scheme is used by most microcomputers?
    11·1 answer
  • Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print "Too small". If greater than
    15·1 answer
  • If a memory reference takes 100 nanoseconds, how long does a paged memory reference take?
    6·1 answer
  • Guys Do you know about e-waste recycling well ?
    9·2 answers
  • 14. Which of the following information about the ESRT T-teen rating rating is FALSE?
    15·1 answer
  • MSWord is a popular___________ program.​
    7·2 answers
  • In cell b12 create a formula using max f7nction to calculate maximum value in B4:B9
    7·1 answer
  • Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar.
    14·1 answer
  • What is the half of 3/18
    6·1 answer
  • Write a program that first reads a list of 5 integers from input. Then, read another value from the input, and output all intege
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!