Question: ll Verizon LTE 2:05 PM bblearn.uca.edu Assignment (Save this file as Lab5-2-YorLastName.cpp) Write a program that accepts real number lab results for a scientific experiment
ll Verizon LTE 2:05 PM bblearn.uca.edu Assignment (Save this file as Lab5-2-YorLastName.cpp) Write a program that accepts real number lab results for a scientific experiment and computes the total and average of these results. a. Prompt and get from the user the name of the experiment and the number of results to be entered. Display an ERROR message if the number of results is invalid (number of results must be greater than b. Use a loop to prompt the user for all results for that experiment and accumulate the total of the results as the user enters them. Store the results and total as real numbers. c. Calculate the average of the results entered. d. Display the name of the experiment, the total and average of the results. Display both of these values to a thousandth of a decimal Sample Input: Please enter the name of the experiment:? Dry Ice How many results would you like to enter? 4 Please enter a result: 2.3 Please enter a result: 2.1 Please enter a result: 5.3 Please enter a result: 6.4 Sample Output: Dry Ice Experiment Calculations: The total of the results is 16.100 The average of the results is: 4.025 Another Sample Input: Please enter the name of the experiment:? Iron and Zinc How many results would you like to enter? 3 Please enter a result: 4.5 Please enter a result: 6.7 Please enter a result: 3.2 Sample Output: Iron and Zinc Experiment Calculations: The total of the results is 14.400 The average of the results is: 4.800
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
