Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Learning Exercises for you to complete1. Change the code to average

Learning Exercises for you to complete<br/>1. Change the code to average

20 integers as opposed to 10. Support your experimentation with screen captures of executing the new code.
2. Prepare a new test table with at least 3 distinct test cases listing input and expected output for the code you created after step 1.
3. What happens if you entered a value other than an integer? (For example a float or even a string). Support your experimentation with screen captures of executing the code.
4. Modify the code to allow the user to enter an unspecified number of positive integers and calculate the average. In other words, the user could enter number of positive integers. (Hint:You can prompt the user for how many they want to enter. Or; you could use a sentinel value to trigger when the user has completed entering values). You may need to conduct some research on your own to solve this problem. Prepare a new test table with at least 3 distinct test cases listing input and expected output for the code you created. Support your experimentation with screen captures of executing the new code.

1CMIS 102 Hands-On LabWeek 5OverviewThis hands-on lab allows you to follow and experiment with the critical steps of developing a programincluding the program description, analysis, test plan, design (using pseudocode), and implementationwith C code.The example provided uses sequential, selection and repetition statements.Program DescriptionThis program will calculate the average of 10 positive integers. The program will ask the user to 10integers. If any of the values entered is negative, a message will be displayed asking the user to enter avalue greater than 0. The program will use a loop to input the data.AnalysisI will use sequential, selection and repetition programming statements.I will define two integer numbers: count, value and sum. count will store how many times values areentered. value will store the input. Sum will store the sum of all 10 integers.I will define one double number: avg. avg will store the average of the ten positive integers input.The sum will be calculated by this formula:sum = sum + valueFor example, if the first value entered was 4 and second was 10:sum = sum + value = 0 + 4sum = 4 + 10 = 14Values and sum can be input and calculated within a repetition loop:while count <10Input valuesum = sum + valueEnd whileAvg can be calculated by:avg = value/countA selection statement can be used inside the loop to make sure the input value is positive.If value >= 0 thencount = count + 1Elseinput valueEnd If
Background image of page 1
2Test PlanTo verify this program is working properly the input values could be used for testing:Test CaseInputExpected Output1value=1value=1value=1value=0value=1value=2value=0value=1value=3value=2Average = 1.22value=100value=100value=100value=100value=100value=200value=200value=200value=200value=200Average = 120.03value=100value=100value=100value=100value=-100value = 100value=200value=200value=200value=200value=200Input a positive valueaverage is 120.0Pseudocode// This program will calculate the average of 10 positive integers.// Declare variablesDeclare count, value, sum as IntegerDeclare avg as double//Initialize value
Background image of page 2

Show 

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"