Question: . . B. (23 Points) Write a complete, working C++ program called euid.cpp (where euid is your EUID) that does the following: Compute the average

 . . B. (23 Points) Write a complete, working C++ program

. . B. (23 Points) Write a complete, working C++ program called euid.cpp (where "euid" is your EUID) that does the following: Compute the average of a range of integers. Note that the bounds of the range are inclusive i.e. they part of the sum and the average computations. Declare an integer variable to store the lower bound of the range of the integers. Declare an integer variable to store the upper bound of the range of the integers. Declare an integer variable to store the sum of the range of the integers. Generate a seeded random integer between 50 and 100, inclusive and store the value in the upper bound variable. Display the value of the upper bound variable using a suitable message. Using cin and cout statements, prompt the user to enter the value of the lower bound number. If the lower bound value is NOT smaller than the upper bound value, provide an error message to the user. o Using a suitable loop, ask for the value again. o You must keep on asking the lower bound value from the user, until the user enters a valid value. You must use a Boolean variable to control this loop. In a different loop of your choice, compute the sum of all the integers between the lower bound and upper bound numbers, the lower and upper bounds are included in the sum computation. Display the average of the numbers using a suitable message. o You must display 2 decimal numbers after the decimal point. Due to time constraints, no comments are required in this code. o . SAMPLE OUTPUT Here are some outputs to help you write the code. The items in bold is entered by the user. $.a. out Generated upper bound: 73 Enter lower bound number:74 You must enter a number smaller than 73. Enter again. Enter lower bound number: 85 You must enter a number smaller than 73. Enter again. Enter lower bound number: 70 Average: 71.50 $ ./a.out Generated upper bound: 98 Enter lower bound number: 97 Average: 97.50

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!