Cash-back offer from May 7th to 12th, 2024: Get a flat 10% cash-back credited to your account for a minimum transaction of $50.Post Your Questions Today!

Question DetailsNormal
$ 14.00

Week 4 CMIS 102 Hands-On Lab complete solutions correct answers key

Question posted by
Online Tutor Profile
request

Week 4 CMIS 102 Hands-On Lab complete solutions correct answers key

 

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 example provided uses sequential and selection statements.

Program Description

This program will calculate the sum of 5 integers. The program will ask the user to 5 integers. If the sum of the numbers is greater than 100, a message is printed stating the sum is over 100. The design step will include both pseudocode.

Analysis

I will use sequential, and selection programming statements. I will define six integer numbers: value1, value2, value3, value4, value5 and sum. The value1, value2, value3, value4 and value5 variables will store the integers input by the user. The sum will store the sum of the 5 values. The sum will be calculated by this formula: sum = value1 + value2 + value3 + value4 + value5 For example, if the first values entered were 1,1,2,2 and 3 respectively: sum = 1 + 1 + 2 + 2 + 3 = 9

The additional selection statement will be of this form:

If sum > 100 then print "Sum is over 100" End If

Test Plan

To verify this program is working properly the input values could be used for testing: Test Case

Input

Expected Output

1

value1=1 value2=1 value3=1 value4=0

Value5=2

Sum = 5

2

value=100 value=100 value=100 value=100

value=200

Sum = 600 Sum is over 100.

3

value= -100 value= -100 value= -200 value = 0

value= 200

Sum = -200

Pseudocode

// This program will calculate the sum of 5 integers.

// Declare variables Declare value1, value2, value3, value4, value5, sum as Integer //Initialize Sum to 0 Set sum = 0

// Enter values Print “Enter an Integer for value1” Input value1 Print “Enter an Integer for value2” Input value2 Print “Enter an Integer for value3” Input value3 Print “Enter an Integer for value4” Input value4 Print “Enter an Integer for value5” Input value5

// Calculate sum sum = value1 + value2 + value3 + value4 + value5

// Print results and messages Print “Sum is “ + sum If (sum > 100) Printf “Sum is over 100” End if

C Code

The following is the C Code that will compile in execute in the online compilers.

// C code

// This program will calculate the sum of 5 integers.

// Developer: Faculty CMIS102

// Date: Jan 31, XXXX

#include <stdio.h>

int main ()

{

/* variable definition: */

int value1,value2,value3,value4,value5,sum;

/* Initialize sum */

sum = 0;

printf("Enter an Integer for value1\n"); scanf("%d", &value1); printf("Enter an Integer for value2\n"); scanf("%d", &value2); printf("Enter an Integer for value3\n"); scanf("%d", &value3); printf("Enter an Integer for value4\n"); scanf("%d", &value4); printf("Enter an Integer for value5\n"); scanf("%d", &value5);

sum = value1 + value2 + value3 + value4 + value5;

printf("Sum is %d\n " , sum );

if (sum >100)

printf("Sum is over 100\n");

return 0;

}

Setting up the code and the input parameters in ideone.com:

Note the input integer values are 100, 100, 100, 200 and 100, for this test case. You can change these values to any valid integer values to match your test cases.

Results from running within ideone

Learning Exercises for you to complete

1. Change the C code to sum 10 integers as opposed to 5? (Hint: Please don’t use arrays or Loops for this. We will be using those features in another week.) Support your experimentation with a screen capture of executing the new code

 

2. Using the code you create in step 1, modify the code to print an additional statement if the sum of the value is negative (Hint: Consider modifying the existing selection statement) Support your experimentation with a screen capture of executing the new code.

 

3. Prepare a new test table with at least 3 distinct test cases listing input and expected output for the code you created after step 2.

 

4. Create your own C code implementation of one of the following mathematical formulas:

 

a. y = mx + b; (slope of a line) Assume the user will be prompted to input m, x and b and the program will calculate y. If the value of y is greater than 10, inform the user the value is greater than 10.

b. a = PI * r*r; (area of circle). Assume the user will be prompted to input the radius r. You can define PI as 3.1416. . If the value of a is greater than 10, inform the user the value is greater than 10.

c. v = 4/3 PI r*r; (volume of sphere) Assume the user will be prompted to input the radius r. You can define PI at 3.1416. If the value of v is greater than 10, inform the user the value is greater than 10.

 

Be sure you provide not only the C code but a test table with at least 3 distinct test cases listing input and expected output your mathematical formula.

Submission

Submit a neatly organized word (or PDF) document that demonstrates you successfully executed this lab on your machine using an online compiler. You should provide a screen capture of the resulting output. Submit all C code you created in files.

Also, provide the answers and any associated screen captures of your successful completion of exercises 1, 2, 3 and 4.

Submit your document no later than the due date listed in the syllabus or calendar.

Available Answer
$ 14.00

[Solved] Week 4 CMIS 102 Hands-On Lab complete solutions correct answers key

  • This solution is not purchased yet.
  • Submitted On 18 Jan, 2017 10:11:51
Answer posted by
Online Tutor Profile
solution
Week 4 CMIS 102 Hands-On Lab complete solutions correct answers key 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 example provided uses sequential and selection statements. Program Description This program will calculate the sum of 5 integers. The program will ask the user to 5 integers. If the sum of the numbers is greater than 100, a message is printed stating the sum is over 100. The design step will include both pseudocode. Analysis I will use sequential, and selection programming statements. I will define six integer numbers: value1, value2, value3, value4, value5 and sum. The value1, value2, value3, value4 and value5 variables will store the integers input by the user. The sum will store the sum of the 5 values. The sum will be calculated by this formula: sum = value1 + value2 + value3 + value4 + value5 For example, if the first values entered were 1,1,2,2 and 3 respectively: sum = 1 + 1 + 2 + 2 + 3 = 9 The additional selection statement will be of this form: If sum > 100 then print "Sum is over 100" End If Test Plan To verify this program is working properly the input values could be...
Buy now to view the complete solution
attachment
Attachment
Other Similar Questions
User Profile
termp...

week 4 CMC strat planning boom.docx Running Head CMC 1

Week 4 CMC strat planning boom.docx Running Head CMC 1 MGMT615 Com...
User Profile
termp...

week 4 CMC strat planning boom.docx Running Head CMC 1

Week 4 CMC strat planning boom.docx Running Head CMC 1 MGMT615 Co...
User Profile
vpqnr...

Week 4 CMIS 102 Hands-On Lab complete solutions correct answers key

Week 4 CMIS 102 Hands-On Lab complete solutions correct answers key 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 ...

The benefits of buying study notes from CourseMerits

homeworkhelptime
Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
tutoring
Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.
tutorsupport
Uninterrupted 24/7 Support
Our customer support wing remains online 24x7 to provide you seamless assistance. Also, when you post a query or a request here, you can expect an immediate response from our side.
closebutton

$ 629.35