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

Question DetailsNormal
$ 22.00

CMIS 102 Hands-On Lab Week

Question posted by
Online Tutor Profile
request

The Assignment:

In pseudocode and in C code, declare a 1-dimensional array of Integers called InternetHits that will hold up to 10 Integer values representing the number of hits a Web site receives.

Use a For loop to iterate through the array and input the values.

Demonstrate your code compiles and runs for a test case of your choice. Use the lab information below.

Lab:

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 visualization), and implementation with C code. The example provided uses sequential,repetition, selection statements and arrays.

Program Description:

This program will input and store meteorological data into an array. The program will prompt the user to enter the average monthly rainfall for a specific region and then use a loop to cycle through the array and print out each value. The program should store up 5 years of meteorological data.

Analysis:

I will use sequential, selection, and repetition programming statements and an array to store data. 
I will define an array of Float number: Raindata[] to store the Float values input by the user. To store up to 5 years of monthly data, the array size should be at least 5*12 = 60 elements.
A float number (rain) will also be needed to input the individual rain data.
An integer variable (Count) is needed to keep count of how many rain data elements were entered. This will keep track to make sure we don’t go over 60 and we print only valid rain elements.
A for loop can be used to iterate through the array to enter Raindata. A for loop can also be used to print the data in the array.

Test Plan:

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

Test Case

Input

Expected Output

1

Raindata[0]=2.2
Raindata[0]=2.1
Raindata[0]=0.6
Raindata[0]=2.9
Raindata[0]=4.6
Raindata[0]=3.1
Raindata[0]=0.1
Raindata[0]=0.3
Raindata[0]=0.5
Raindata[0]=5.4

2.2

2.1

0.6

2.9

4.6

3.1

0.1

0.3

0.5

5.4

2

Raindata[0]=6.2
Raindata[0]=5.1
Raindata[0]=4.6
 

6.2
5.1

4.6

3

Raindata[0]=2.6
Raindata[0]=4.2
 

2.6

4.2

 

Pseudocode:

// This program will input and store meteorological data into an array.

// Declare variables
Declare Raindata[60] as Float
Declare Rain as Float
Declare Count, i as Integer

// Set Initial Values
Set Rain=1.0
Set Count = 0

// Input Data
While Rain > 0
print "Enter rain " 
Input Rain

If Rain > 0 
Set Raindata[Count]=Rain
count= count + 1
End If

End While

// Print data
For i=0; I < count; i++
print Raindata[i]
End For

C Code

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

// C code

// This program will input and store meteorological data into an array.

// Developer: Faculty CMIS102

// Date: Jan 31, 2014

#include <stdio.h>

int main ()

{

/* variable definition: */

float Raindata[60];

float Rain=1.0;

int count=0,i;

// Input Data

while (Rain > 0)

{

printf("Enter rain\n");

scanf("%f",&Rain);

// Only assign if positive

if (Rain > 0) {

Raindata[count]=Rain;

count= count + 1;

}

}

// Print data

for (i=0; i<count;i++)

printf ("Data element %d is %f\n", i,Raindata[i]);

return 0;

}

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

Note the Input values for this run were:
3.2
2.1
6.5
9.4
0.3
0.2
-1
You can change these values to any valid integer values to match your test cases.

Results from running the programming at ideone.com:

Learning Exercises for you to try:

How would you modify the program to sum all of the rainfall values?

What happens if you attempt to add more than 60 elements to the Raindata array?

(Hint: You can try this by changing the code to Raindata[5] and then try to enter 6 elements.)

Try to modify the code to add another Array to store Windspeed or another meteorological element.

 

 

C Code:

// C code

// This program will input and store meteorological data into an array.

// Developer: Faculty CMIS102

// Date: Jan 31, 2014

#include <stdio.h>

int main ()

{

  /* variable definition: */

  float Raindata[60];

  float Rain=1.0;

  int count=0,i;

  

   // Input Data

   while (Rain > 0)

   {

     printf("Enter rain\n");

     scanf("%f",&Rain);

     // Only assign if positive

     if (Rain > 0) {

        Raindata[count]=Rain;

        count= count + 1;

     }

    }

 

   // Print data

   for (i=0; i<count;i++)

     printf ("Data element %d is %f\n", i,Raindata[i]);

  

   return 0;

}

 

 

Available Answer
$ 22.00

[Solved] CMIS 102 Hands-On Lab Week

  • This solution is not purchased yet.
  • Submitted On 13 May, 2016 07:19:38
Answer posted by
Online Tutor Profile
solution
The Assignment: In pseudocode and in C code, declare a 1-dimensional array of Integers called InternetHits that will hold up to 10 Integer values representing the number of hits a Web site receives. Use a For loop to iterate through the array and input the values. Demonstrate your code compiles and runs for a test case of your choice. Use the lab information below. Lab: 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 visualization), and implementation with C code. The example provided uses sequential,repetition, selection statements and arrays. Program Description: This program will input and store meteorological data into an array. The program will prompt the user to enter the average monthly rainfall for a specific region and then use a loop to cycle through the array and print out each value. The program should store up 5 years of meteorological data. Analysis: I will use sequential, selection, and repetition programming statements and an arr...
Buy now to view the complete solution
Other Similar Questions
User Profile
Tutor...

University of Maryland CMIS 102 Hands-On Lab Week 8 Lab

CMIS 102 Week 8 Hands-On Lab 1. To successfully carry out this code I assigned the sum of rainfall to a variable called totalRain. This variable is defined as the rainfall of each month of the year in the array. I also decla...
User Profile
vpqnr...

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

CMIS 102 Hands-On Lab Week 5 complete solutions correct answers key CMIS 102 Hands-On Lab Week 5 Overview This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the ...
User Profile
vpqnr...

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

CMIS 102 Hands-On Lab Week 8 complete solutions correct answers key CMIS 102 Hands-On Lab Week 8 Overview This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the pr...
User Profile
vpqnr...

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

CMIS 102 Hands-On Lab Week 7 complete solutions correct answers key CMIS 102 Hands-On Lab Week 7 Overview This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the ...
User Profile
vpqnr...

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

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