[Solved] CMIS 102 Hands-On Lab Week 8

Click And Check all our Assignments
Click Here and Upload you Assignment for Free!


100/100 Trustscore on scamadviser.com

10 USD $

Category: Tag:

5/5 – (6 votes)

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

Program DescriptionThis 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. Data is collected once per month. The program should provide the option to the user of not entering any data.

AnalysisI will use sequential, selection, and repetition programming statements and an array to store data.I will define a 2-D 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. In a 2D array this will be RainData[5][12]. We can use #defines to set the number of years and months to eliminate hardcodingvalues.A float number (rain) will also be needed to input the individual rain data.A nested for loop can be used to iterate through the array to enter Raindata. A nested for loop can also be used to print the data in the array.A array of strings can be used to store year and month names. This will allow a tabular display with labels for the printout.Functions will be used to separate functionality into smaller work units. Functions for displaying the data and inputting the data will be used.A selection statement will be used to determine if data should be entered.

Test PlanTo verify this program is working properly the input values could be used for testing:Test Case Input Expected Output1 Enter data? = y1. month rain2011 Jan 1.202011 Feb 2.202011 Mar 3.302011 Apr 2.202011 May 10.202011 Jun 12.202011 Jul 2.302011 Aug 0.402011 Sep 0.202011 Oct 1.102011 Nov 2.102011 Dec 0.4020. Jan 1.102012 Feb 2.202012 Mar 3.302012 Apr 2.202012 May 10.202012 Jun 12.202012 Jul 2.302012 Aug 0.402012 Sep 0.202012 Oct 1.102012 Nov 2.102012 Dec 0.402013 Jan 1.102013 Feb 2.202013 Mar 3.302013 Apr 2.202013 May 10.202013 Jun 12.202013 Jul 2.302013 Aug 0.402013 Sep 0.202013 Oct 1.102013 Nov 2.102013 Dec 0.402014 Jan 1.10 2014 Feb 2.202014 Mar 3.302014 Apr 2.202014 May 10.202014 Jun 12.202014 Jul 2.302014 Aug 0.402014 Sep 0.202014 Oct 1.102014 Nov 2.102014 Dec 0.402015 Jan 1.102015 Feb 2.202015 Mar 3.302015 Apr 2.202015 May 10.202015 Jun 12.202015 Jul 2.302015 Aug 0.402015 Sep 0.202015 Oct 1.102015 Nov 2.102015 Dec 0.40Please try thePrecipitation program again.2 Enter data? = n No data was input atthis time.3Please try thePrecipitation programagain.C CodeThe 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, XXXX#define NUMMONTHS 12#define NUMYEARS 5#include <stdio.h// function prototypesvoid inputdata();void printdata();// Global variables// These are available to all functionsfloat Raindata[NUMYEARS][NUMMONTHS];char years[NUMYEARS][5] = {“2011″,”2012″,”2013″,”2014″,”2015”};char months[NUMMONTHS][12]={“Jan”,”Feb”,”Mar”,”Apr”,”May”,”Jun”,”Jul”,”Aug”,”Sep”,”Oct”,”Nov”,”Dec”};int main (){char enterData = ‘y’;printf(“Do you want to input Precipatation data? (y for yes)
”);scanf(“%c”,&enterData);if (enterData == ‘y’) {// Call Function to Input datainputdata();

// Call Function to display dataprintdata();}else {printf(“No data was input at this time
”);}printf(“Please try the Precipitation program again.
”);return 0;}// function to inputdatavoid inputdata() {/* variable definition: */float Rain=1.0;// Input Datafor (int year=0;year < NUMYEARS; year++) {for (int month=0; month< NUMMONTHS; month++) {printf(“Enter rain for %d, %d:
”, year+1, month+1);scanf(“%f”,&Rain);Raindata[year][month]=Rain;4}}}// Function to printdatavoid printdata(){// Print dataprintf (“yeart montht rain
”);for (int year=0;year < NUMYEARS; year++) {for (int month=0; month< NUMMONTHS; month++) {printf(“%st %st %5.2f
”,years[year],months[month],Raindata[year][month]);}}}Setting up the code and the input parameters in ideone.com:You can change these values to any valid integer values to match your test cases.5Results from running the programming at ideone.com6


There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CMIS 102 Hands-On Lab Week 8
10 USD $