{"id":208871,"date":"2018-09-14T09:26:26","date_gmt":"2018-09-14T09:26:26","guid":{"rendered":"http:\/\/localhost\/wordpress\/index.php\/2018\/09\/14\/cmis-102-week-4-hands-on-lab\/"},"modified":"2018-10-24T08:58:07","modified_gmt":"2018-10-24T08:58:07","slug":"cmis-102-week-4-hands-on-lab","status":"publish","type":"post","link":"https:\/\/www.benedictsol.com\/blogs\/cmis-102-week-4-hands-on-lab\/","title":{"rendered":"CMIS 102 Week 4 Hands on Lab"},"content":{"rendered":"<p>CMIS 102 Hands-On Lab\tWeek 4\tOverview\tThis hands-on lab allows you to follow and experiment with the critical steps of developing a program\tincluding the program description, analysis, test plan, design (using pseudocode), and implementation\twith C code. The example provided uses sequential and selection statements.\tProgram Description\tThis program will calculate the sum of 5 integers. The program will ask the user to 5 integers. If the sum\tof the numbers is greater than 100, a message is printed stating the sum is over 100. The design step will\tinclude both pseudocode.\tAnalysis\tI will use sequential, and selection programming statements.\tI will define six integer numbers: value1, value2, value3, value4, value5 and sum. The value1, value2,\tvalue3, value4 and value5 variables will store the integers input by the user. The sum will store the sum\tof the 5 values.\tThe sum will be calculated by this formula:\tsum = value1 + value2 + value3 + value4 + value5\tFor example, if the first values entered were value 1=1, value 2=1, value 3=2,value 4=2 and value 5=3\trespectively:\tsum = 1 + 1 + 2 + 2 + 3 = 9\tThe additional selection statement will be of this form:\tIf sum &gt; 100 then\tprint &quot;Sum is over 100&quot;\tEnd If Test Plan\tTo verify this program is working properly the input values could be used for testing:\tTest Case\t1 2 Input\tvalue1=1\tvalue2=1\tvalue3=1\tvalue4=0\tValue5=2\tvalue=100\tvalue=100\tvalue=100\tvalue=100\tvalue=200 Expected Output\tSum = 5 Sum = 600\tSum is over 100. 1 3 value= -100\tvalue= -100\tvalue= -200\tvalue = 0\tvalue= 200 Sum = -200 Pseudocode\t\/\/ This program will calculate the sum of 5 integers.\t\/\/ Declare variables\tDeclare value1, value2, value3, value4, value5, sum as Integer\t\/\/Initialize Sum to 0\tSet sum = 0\t\/\/ Enter\tPrint\tInput\tPrint\tInput\tPrint\tInput\tPrint\tInput\tPrint\tInput values\t&#8220;Enter\tvalue1\t&#8220;Enter\tvalue2\t&#8220;Enter\tvalue3\t&#8220;Enter\tvalue4\t&#8220;Enter\tvalue5 an Integer for value1&#8243;\ufffd\tan Integer for value2&#8243;\ufffd\tan Integer for value3&#8243;\ufffd\tan Integer for value4&#8243;\ufffd\tan Integer for value5&#8243;\ufffd \/\/ Calculate sum\tsum = value1 + value2 + value3 + value4 + value5\t\/\/ Print results and messages\tPrint &#8220;Sum is &#8221; + sum\tIf (sum &gt; 100)\tPrintf &#8220;Sum is over 100&#8243;\ufffd\tEnd if C Code\tThe following is the C Code that will compile in execute in the online compilers.\t\/\/ C code\t\/\/ This program will calculate the sum of 5 integers.\t\/\/ Developer: Faculty CMIS102\t\/\/ Date: Jan 31, XXXX\t#include &lt;stdio.h&gt;\tint main () 2 {\t\/* variable definition: *\/\tint value1,value2,value3,value4,value5,sum; \/* Initialize sum *\/\tsum = 0;\tprintf(&quot;Enter an Integer\tscanf(&quot;%d&quot;, &amp;value1);\tprintf(&quot;Enter an Integer\tscanf(&quot;%d&quot;, &amp;value2);\tprintf(&quot;Enter an Integer\tscanf(&quot;%d&quot;, &amp;value3);\tprintf(&quot;Enter an Integer\tscanf(&quot;%d&quot;, &amp;value4);\tprintf(&quot;Enter an Integer\tscanf(&quot;%d&quot;, &amp;value5); for value1n&quot;);\tfor value2n&quot;);\tfor value3n&quot;);\tfor value4n&quot;);\tfor value5n&quot;); sum = value1 + value2 + value3 + value4 + value5;\tprintf(&quot;Sum is %dn &quot; , sum );\tif (sum &gt;100)\tprintf(&quot;Sum is over 100n&quot;);\treturn 0;\t} Setting up the code and the input parameters in ideone.com:\tNote the input integer values are 100, 100, 100, 200 and 100, for this test case. You can change these\tvalues to any valid integer values to match your test cases. 3 Results from running within ideone 4 Learning Exercises for you to complete\t1. Demonstrate you successfully followed the steps in this lab by preparing screen captures of you\trunning the lab as specified in the Instructions above.\t2. Change the C code to sum 10 integers as opposed to 5? (Hint: Please don&#8217;t use arrays or Loops\tfor this. We will be using those features in another week.) Support your experimentation with a\tscreen capture of executing the new code 3. Using the code you create in step 1, modify the code to print an additional statement if the sum\tof the value is negative (Hint: Consider modifying the existing selection statement) Support your\texperimentation with a screen capture of executing the new code. 4. Prepare a new test table with at least 3 distinct test cases listing input and expected output for\tthe code you created after step 2.\t5. Create your own C code implementation of one of the following mathematical formulas:\ta. y = mx + b; (slope of a line) Assume the user will be prompted to input m, x and b and\tthe program will calculate y. If the value of y is greater than 10, inform the user the\tvalue is greater than 10.\tb. a = PI * r*r; (area of circle). Assume the user will be prompted to input the radius r. You\tcan define PI as 3.1416. . If the value of a is greater than 10, inform the user the value is\tgreater than 10.\tc. v = 4\/3 PI r*r*r; (volume of sphere) Assume the user will be prompted to input the\tradius r. You can define PI at 3.1416. If the value of v is greater than 10, inform the user\tthe value is greater than 10.\tBe sure you provide not only the C code but a test table with at least 3 distinct test cases listing\tinput and expected output your mathematical formula. Submission\tSubmit a neatly organized word (or PDF) document that demonstrates you successfully executed this lab\ton your machine using an online compiler. You should provide a screen capture of the resulting output.\tSubmit all C code you created in files.\tAlso, provide the answers and any associated screen captures of your successful completion of exercises\t1, 2, 3 and 4.\tSubmit your document no later than the due date listed in the syllabus or calendar.\t5 Grading guidelines\tSubmission\tDemonstrates the successful execution of this Lab within an\tonline compiler. Provides supporting screen captures.\tModifies the C code to sum 10 integers as opposed to 5.\tSupports your experimentation with screen captures of\texecuting the code.\tUsing the code created in step 1, modifies the code to print\tan additional statement if the sum of the value is negative\tSupports your experimentation with a screen capture of\texecuting the new code.\tProvides a new test table with at least 3 distinct test cases\tlisting input and expected output for the code you created\tafter step 2.\tCreates your own unique C code implementation of one of\tthe provided mathematical formulas. Provides a new test\ttable with at least 3 distinct test cases listing input and\texpected output your mathematical formula. Supports your\texperimentation with a screen capture of executing the new\tcode.\tDocument is well-organized, and contains minimal spelling\tand grammatical errors.\tTotal Points\t2\t2 2 1 2 1\t10 6<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CMIS 102 Hands-On Lab Week 4 Overview This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, analysis, test plan, design (using pseudocode), and implementation with C code. The <a href=\"https:\/\/www.benedictsol.com\/blogs\/cmis-102-week-4-hands-on-lab\/\" class=\"read-more\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-208871","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/posts\/208871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/comments?post=208871"}],"version-history":[{"count":0,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/posts\/208871\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/media?parent=208871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/categories?post=208871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/tags?post=208871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}