SlideShare a Scribd company logo
CMIS 102 Hands-On Lab Week 8 Overview
FOR MORE CLASSES VISIT
tutorialoutletdotcom
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 program description, analysis, test plan, and
implementation with C code. The example
provided uses sequential, repetition, selection statements, functions,
strings 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. Data is collected
once per month. The program should provide the option to the user of
not entering any data.
Analysis
I 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 hardcoding values.
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 Plan
To verify this program is working properly the input values could be
used for testing:
Test Case
1 Input Expected Output Enter data? = y
1.2
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1 year
2011
2011
2011
2011
2011
2011
2011
2011
2011
2011
2011
2011 month
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec rain
1.20
2.20
3.30
2.20
10.20
12.20
2.30
0.40
0.20
1.10
2.10
0.40 1 2 0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4 2012
Jan
1.10
2012
Feb
2.20
2012
Mar
3.30
2012
Apr
2.20
2012
May
10.20
2012
Jun
12.20
2012
Jul
2.30
2012
Aug
0.40
2012
Sep
0.20
2012
Oct
1.10
2012
Nov
2.10
2012
Dec
0.40
2013
Jan
1.10
2013
Feb
2.20
2013
Mar
3.30
2013
Apr
2.20
2013
May
10.20
2013
Jun
12.20
2013
Jul
2.30
2013
Aug
0.40
2013
Sep
0.20
2013
Oct
1.10
2013
Nov
2.10
2013
Dec
0.40
2014
Jan
1.10
2014
Feb
2.20
2014
Mar
3.30
2014
Apr
2.20
2014
May
10.20
2014
Jun
12.20
2014
Jul
2.30
2014
Aug
0.40
2014
Sep
0.20
2014
Oct
1.10
2014
Nov
2.10
2014
Dec
0.40
2015
Jan
1.10
2015
Feb
2.20
2015
Mar
3.30
2015
Apr
2.20
2015
May
10.20
2015
Jun
12.20
2015
Jul
2.30
2015
Aug
0.40
2015
Sep
0.20
2015
Oct
1.10
2015
Nov
2.10
2015
Dec
0.40
Please try the
Precipitation program
again. Enter data? = n No data was input at
this time. 2 Please try the
Precipitation program
again. 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, XXXX
#define NUMMONTHS 12
#define NUMYEARS 5
#include <stdio.h>
// function prototypes
void inputdata();
void printdata();
// Global variables
// These are available to all functions
float Raindata[NUMYEARS][NUMMONTHS];
char years[NUMYEARS][5] =
{"2011","2012","
2013","2014","2015"};
char months[NUMMONTHS][12]
={"Jan","Feb","Mar","Apr&q
uot;,"
May","Jun","Jul","Aug",&quo
t;Sep&quot
;,"Oct","Nov","Dec"};
int main ()
{
char enterData = 'y';
printf("Do you want to input Precipatation data? (y for
yes)n");
scanf("%c",&enterData);
if (enterData == 'y') {
// Call Function to Input data
inputdata();
// Call Function to display data
printdata();
}
else {
printf("No data was input at this timen");
}
printf("Please try the Precipitation program again. n");
return 0;
}
// function to inputdata
void inputdata() {
/* variable definition: */
float Rain=1.0;
// Input Data
for (int year=0;year < NUMYEARS; year++) {
for (int month=0; month< NUMMONTHS; month++) {
printf("Enter rain for %d, %d:n", year+1, month+1);
scanf("%f",&Rain);
Raindata[year][month]=Rain; 3 }
}
}
// Function to printdata
void printdata(){
// Print data
printf ("yeart montht rainn");
for (int year=0;year < NUMYEARS; year++) {
for (int month=0; month< NUMMONTHS; month++) {
printf("%st %st %5.2fn",
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. 4 Results from running
the programming at ideone.com 5 Learning Exercises for you to
complete
1. Demonstrate you successfully followed the steps in this lab by
preparing screen captures of you
running the lab as specified in the Instructions above.
2. Modify the program to add a function to sum the rainfall for each
year. (Hint: you need to sum for
each year. You can do this using a looping structure). Support your
experimentation with screen
captures of executing the new code.
3. Enhance the program to allow the user to enter another meteorological
element such as windspeed
(e.g. 2.4 mph). Note, the user should be able to enter both rainfall and
windspeed in your new
implementation. Support your experimentation with screen captures of
executing the new code.
4. Prepare a new test table with at least 2 distinct test cases listing input
and expected output for the
code you created after step 2.
5. What happens if you change the NUMMONTHS and NUMYEARS
definitions to other values? Be sure
to use both lower and higher values. Describe and implement fixes for
any issues if errors results.
Support your experimentation with screen captures of executing the new
code.
Grading guidelines
Submission
Demonstrates the successful execution of this Lab within an
online compiler. Provides supporting screen captures.
Modifies the code to add a function to sum the rainfall for each
year. Support your experimentation with screen captures of
executing the new code.
Enhances the program to allow the user to enter another
meteorological element such as windspeed (e.g. 2.4 mph).
Support your experimentation with screen captures of executing
the new code.
Provides a new test table with at least 2 distinct test cases listing
input and expected output for the code you created after step 2.
Describes what would happen if you change the NUMMONTHS
and NUMYEARS definitions to other values? Applies both lower
and higher values. Describes and implements fixes for any issues
if errors results. Support your experimentation with screen
captures of executing the new code.
Document is well-organized, and contains minimal spelling and
grammatical errors.
Total Points
2
2 2 1
2 1
************************************************

More Related Content

PPTX
3.3 the math object
DOCX
electic mashinary fundamentals 5th edition Lab tasks stack
PPTX
3.2 stacks and arrays
DOCX
Cis 355 i lab 3 of 6
PDF
RBD-Demo
PPTX
Sql FUNCTIONS
PPTX
3.3 the math object
electic mashinary fundamentals 5th edition Lab tasks stack
3.2 stacks and arrays
Cis 355 i lab 3 of 6
RBD-Demo
Sql FUNCTIONS

What's hot (20)

PPTX
Ads final report - Team 8
PDF
Calculator Program in C#.NET
PPTX
Internship_Presentation
PDF
TIME SERIES ANALYSIS USING ARIMA MODEL FOR FORECASTING IN R (PRACTICAL)
PDF
Scaling in R
DOCX
Programming questions
PDF
Matlab data import
PPT
16858 memory management2
PPSX
Data Structure (Stack)
PDF
Stata time-series-fall-2011
PDF
PDF
Observer Pattern
PPTX
Date & time functions in VB.NET
 
PPT
3D Analyst - Cut and Fill
PDF
Energy Wasting Rate as a Metrics for Green Computing and Static Analysis
PDF
Help of knn wg
PDF
Weather scraper for your data warehouse
PDF
Programming Fundamental handouts
PPT
16829 memory management2
PPTX
MS Sql Server: Doing Calculations With Functions
Ads final report - Team 8
Calculator Program in C#.NET
Internship_Presentation
TIME SERIES ANALYSIS USING ARIMA MODEL FOR FORECASTING IN R (PRACTICAL)
Scaling in R
Programming questions
Matlab data import
16858 memory management2
Data Structure (Stack)
Stata time-series-fall-2011
Observer Pattern
Date & time functions in VB.NET
 
3D Analyst - Cut and Fill
Energy Wasting Rate as a Metrics for Green Computing and Static Analysis
Help of knn wg
Weather scraper for your data warehouse
Programming Fundamental handouts
16829 memory management2
MS Sql Server: Doing Calculations With Functions
Ad

Similar to Cmis 102 hands on/tutorialoutlet (20)

DOCX
1 CMIS 102 Hands-On Lab Week 8 Overview Th.docx
PDF
Chapter 16-spreadsheet1 questions and answer
DOCX
Write a program that uses nested loops to collect data and calculate .docx
PDF
Assignment Details There is a .h file on Moodle that provides a defi.pdf
PDF
PRELIM-Lesson-2.pdf
PDF
ABAP for Beginners - www.sapdocs.info
PDF
Problem Solving with C++ 9th Edition Savitch Solutions Manual
PDF
Notes how to work with variables, constants and do calculations
DOCX
OverviewThis hands-on lab allows you to follow and experiment w.docx
PDF
Problem Solving with C++ 9th Edition Savitch Solutions Manual
PDF
IRJET - Intelligent Weather Forecasting using Machine Learning Techniques
PDF
13 -times_and_dates
PPTX
Spry Scheduling and Haulage model - Tutorial
DOCX
Sample Questions The following sample questions are not in.docx
DOCX
COMP 122 Entire Course NEW
PPSX
04 intel v_tune_session_05
PDF
TAO Fayan_ Introduction to WEKA
PDF
Learning SAS by Example -A Programmer’s Guide by Ron CodySolution
DOCX
E2 – Fundamentals, Functions & ArraysPlease refer to announcements.docx
PDF
Develop a system flowchart and then write a menu-driven C++ program .pdf
1 CMIS 102 Hands-On Lab Week 8 Overview Th.docx
Chapter 16-spreadsheet1 questions and answer
Write a program that uses nested loops to collect data and calculate .docx
Assignment Details There is a .h file on Moodle that provides a defi.pdf
PRELIM-Lesson-2.pdf
ABAP for Beginners - www.sapdocs.info
Problem Solving with C++ 9th Edition Savitch Solutions Manual
Notes how to work with variables, constants and do calculations
OverviewThis hands-on lab allows you to follow and experiment w.docx
Problem Solving with C++ 9th Edition Savitch Solutions Manual
IRJET - Intelligent Weather Forecasting using Machine Learning Techniques
13 -times_and_dates
Spry Scheduling and Haulage model - Tutorial
Sample Questions The following sample questions are not in.docx
COMP 122 Entire Course NEW
04 intel v_tune_session_05
TAO Fayan_ Introduction to WEKA
Learning SAS by Example -A Programmer’s Guide by Ron CodySolution
E2 – Fundamentals, Functions & ArraysPlease refer to announcements.docx
Develop a system flowchart and then write a menu-driven C++ program .pdf
Ad

Recently uploaded (20)

PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Pharma ospi slides which help in ospi learning
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
01-Introduction-to-Information-Management.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Classroom Observation Tools for Teachers
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Complications of Minimal Access Surgery at WLH
Microbial diseases, their pathogenesis and prophylaxis
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pharma ospi slides which help in ospi learning
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
01-Introduction-to-Information-Management.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
VCE English Exam - Section C Student Revision Booklet
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Classroom Observation Tools for Teachers
human mycosis Human fungal infections are called human mycosis..pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Supply Chain Operations Speaking Notes -ICLT Program
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Complications of Minimal Access Surgery at WLH

Cmis 102 hands on/tutorialoutlet

  • 1. CMIS 102 Hands-On Lab Week 8 Overview FOR MORE CLASSES VISIT tutorialoutletdotcom 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 program description, analysis, test plan, and implementation with C code. The example provided uses sequential, repetition, selection statements, functions, strings 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. Data is collected once per month. The program should provide the option to the user of not entering any data. Analysis
  • 2. I 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 hardcoding values. 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 Plan To verify this program is working properly the input values could be used for testing:
  • 3. Test Case 1 Input Expected Output Enter data? = y 1.2 2.2 3.3 2.2 10.2 12.2 2.3 0.4 0.2 1.1 2.1 year 2011 2011 2011 2011 2011 2011 2011
  • 5. 2.20 10.20 12.20 2.30 0.40 0.20 1.10 2.10 0.40 1 2 0.4 1.1 2.2 3.3 2.2 10.2 12.2 2.3 0.4 0.2 1.1 2.1
  • 15. Please try the Precipitation program again. Enter data? = n No data was input at this time. 2 Please try the Precipitation program again. 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, XXXX #define NUMMONTHS 12 #define NUMYEARS 5 #include <stdio.h> // function prototypes void inputdata(); void printdata(); // Global variables // These are available to all functions
  • 16. float Raindata[NUMYEARS][NUMMONTHS]; char years[NUMYEARS][5] = {"2011","2012"," 2013","2014","2015"}; char months[NUMMONTHS][12] ={"Jan","Feb","Mar","Apr&q uot;," May","Jun","Jul","Aug",&quo t;Sep&quot ;,"Oct","Nov","Dec"}; int main () { char enterData = 'y'; printf("Do you want to input Precipatation data? (y for yes)n"); scanf("%c",&enterData); if (enterData == 'y') { // Call Function to Input data inputdata(); // Call Function to display data printdata(); }
  • 17. else { printf("No data was input at this timen"); } printf("Please try the Precipitation program again. n"); return 0; } // function to inputdata void inputdata() { /* variable definition: */ float Rain=1.0; // Input Data for (int year=0;year < NUMYEARS; year++) { for (int month=0; month< NUMMONTHS; month++) { printf("Enter rain for %d, %d:n", year+1, month+1); scanf("%f",&Rain); Raindata[year][month]=Rain; 3 } } } // Function to printdata void printdata(){
  • 18. // Print data printf ("yeart montht rainn"); for (int year=0;year < NUMYEARS; year++) { for (int month=0; month< NUMMONTHS; month++) { printf("%st %st %5.2fn", 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. 4 Results from running the programming at ideone.com 5 Learning Exercises for you to complete 1. Demonstrate you successfully followed the steps in this lab by preparing screen captures of you running the lab as specified in the Instructions above. 2. Modify the program to add a function to sum the rainfall for each year. (Hint: you need to sum for each year. You can do this using a looping structure). Support your experimentation with screen captures of executing the new code. 3. Enhance the program to allow the user to enter another meteorological element such as windspeed
  • 19. (e.g. 2.4 mph). Note, the user should be able to enter both rainfall and windspeed in your new implementation. Support your experimentation with screen captures of executing the new code. 4. Prepare a new test table with at least 2 distinct test cases listing input and expected output for the code you created after step 2. 5. What happens if you change the NUMMONTHS and NUMYEARS definitions to other values? Be sure to use both lower and higher values. Describe and implement fixes for any issues if errors results. Support your experimentation with screen captures of executing the new code. Grading guidelines Submission Demonstrates the successful execution of this Lab within an online compiler. Provides supporting screen captures. Modifies the code to add a function to sum the rainfall for each year. Support your experimentation with screen captures of executing the new code. Enhances the program to allow the user to enter another meteorological element such as windspeed (e.g. 2.4 mph). Support your experimentation with screen captures of executing
  • 20. the new code. Provides a new test table with at least 2 distinct test cases listing input and expected output for the code you created after step 2. Describes what would happen if you change the NUMMONTHS and NUMYEARS definitions to other values? Applies both lower and higher values. Describes and implements fixes for any issues if errors results. Support your experimentation with screen captures of executing the new code. Document is well-organized, and contains minimal spelling and grammatical errors. Total Points 2 2 2 1 2 1 ************************************************