Question: Learning objectives: - Summation Looping algorithm - Mini/Max Looping algorithms - Counting algorithm - Sentinel-Controlled Loop General Description: Write an app to be used by

Learning objectives: - Summation Looping algorithm - Mini/Max Looping algorithms - Counting algorithm - Sentinel-Controlled Loop General Description: Write an "app" to be used by engineers and scientists that allows them to enter measurements one at a time, and calculates the average of the measurements entered, dropping the highest and the lowest. The user may not know the number of measurements to be entered, so the app allows the user to indicate "no more measurements" by entering a Sentinel Value. You may assume the user will enter at least 3 measurements (so after dropping the highest and lowest, there is at least one measurement on which to calculate an average). A Sentinel Value is a value entered as data, but is not processed as data, instead it means "end of data" or "no more data". A Sentinel-Controlled Loop is a loop that repeats as long as a Sentinel Value is not entered. It is almost identical to our Play Again? Algorithm. Use -1 as the Sentinel Value for this problem. Thus, the question to ask is: "Enter a measurement (-1 to end):" Specifications/Design: First there are some tasks to do before the loop to prepare for processing: - Since we need a sum, the sum variable should be set to 0 - Since we are counting the number of measurements entered (to calculate the average later), the count variable should be set to 0. - Since we are looking for the largest (max/highest) measurement entered, the max variable should be set to a "ridiculously low" number (let's say -9999). - Since we are looking for the smallest (min/lowest) measurement entered, the min variable should be set to a "ridiculously high" number (let's say 9999). What should be repeated over and over again? - Ask the user to enter a measurement. - Count the measurement. - Add the measurement to the sum - Check if the measurement is the highest seen so far. - Check if the measurement is the lowest seen so far. BUT, note that we only want to do the last 4 steps when the measurement entered is not the Sentinel Value. We do NOT want to count, sum, check max or check min on the -1!!! After all measurements have been entered, counted, summed, etc., we need to calculate the average. Subtract the highest and lowest measurements from the sum; subtract 2 from the count; and divide to get the average. Finally, print the average calculated. Sample Execution: (sample user input in blue) Enter measurement (-1 to end): 80 Enter measurement (-1 to end): 70 Enter measurement (-1 to end): 100 Enter measurement (-1 to end): 90 Enter measurement (-1 to end): -1 The average (dropping extremes) is: 85 Note the 70 and 100 were dropped, and (80 + 90)/2 = 85 Standard requirements for all labs and projects: - Put a comment box at the top with LAB 9, you section and name - Use semicolons at the end of your statements to suppress "Matlab clutter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
