Problem Statement for High and Low Design a program that lets the user enter a series of numbers. The user should enter -99 to signal the end of the series. After all the numbers have been entered, the program should display the highest and lowest number in the series. Part 1. Understand the Problem The program will use a while loop to get the numbers from the user. It is not necessary for the individual numbers to be saved;each number can be evaluated as it is read in. To find the highest and lowest number in the series, use two variables. The variables are initialized by getting the first number from the user and assigning it to both the highest and lowest variables. The assumption is, that if there is only one number in the series it is both the highest and lowest numbers. Inside the loop, each number should be compared to the value stored in the highest variable and its value should replace the value in highest variable if it is greater than the number already there. The same can be done for the lowest variable, except the number is reassigned only if it is less than the number already there.After the comparison are done, prompt the user for the next number to input. The loop is controlled by the number read in andwill terminate when a sentinel value (in this case -99) is input by the user. Remember that the only way a computer can make this test is by comparing the value of two numbers (in this case for equality) and returning a result of true if the comparison succeeds or false if the comparison fails. The number to be compared to the input is called the sentinel value and is assigned to a variable at the beginning of the program.After reading in the first number, your prompt should tell the user what the exact sentinel value is to end the loop.Once the loop is terminated, display the values in the highest and lowest variables. To test the program, enter a series of numbers ending with -99 and verify that the program displays the highest and lowest values in the series. For example, if the user enters 3 5 1 7 8 4 9 2, the highest would be 9 and the lowest would be 1. (PYTHON)

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.7: Do While Loops
Problem 2E: (Misc. application) a. Write a program that continuously requests a grade to be entered. If the...
icon
Related questions
Question

Problem Statement for High and Low

Design a program that lets the user enter a series of numbers. The user should enter -99 to signal the end of the series. After all the numbers have been entered, the program should display the highest and lowest number in the series.

Part 1. Understand the Problem

The program will use a while loop to get the numbers from the user. It is not necessary for the individual numbers to be saved;each number can be evaluated as it is read in.

To find the highest and lowest number in the series, use two variables. The variables are initialized by getting the first number from the user and assigning it to both the highest and lowest variables. The assumption is, that if there is only one number in the series it is both the highest and lowest numbers.

Inside the loop, each number should be compared to the value stored in the highest variable and its value should replace the value in highest variable if it is greater than the number already there. The same can be done for the lowest variable, except the number is reassigned only if it is less than the number already there.After the comparison are done, prompt the user for the next number to input.

The loop is controlled by the number read in andwill terminate when a sentinel value (in this case -99) is input by the user. Remember that the only way a computer can make this test is by comparing the value of two numbers (in this case for equality) and returning a result of true if the comparison succeeds or false if the comparison fails.

The number to be compared to the input is called the sentinel value and is assigned to a variable at the beginning of the program.After reading in the first number, your prompt should tell the user what the exact sentinel value is to end the loop.Once the loop is terminated, display the values in the highest and lowest variables.

To test the program, enter a series of numbers ending with -99 and verify that the program displays the highest and lowest values in the series. For example, if the user enters 3 5 1 7 8 4 9 2, the highest would be 9 and the lowest would be 1.

(PYTHON)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage