Prepare a new test table with at least 2 distinct test


Assignment

Overview:

This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, Analysis, Design(program design, pseudocode), 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.

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.

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. In a 2D array this will be RainData[5][12]. We can use #defines to set the number of years and months to eliminate hard coding 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, where the outer loop will be years and the inner loop will be months. A similar nested for loop can also be used to print the data in the array, where the outer loop will be years and the inner loop will be months. An 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.

Learning Exercises for you to try:

1. Modify the program to sum the rainfall for eachyear.

(Hint: this is NOT part of the input. You have all the data collected, you need to sum for each year from the data you collected during the input.) You can do this using a looping structure during the output function printdata.) Support your experimentation with screen captures of executing the new code

2. Enhance the program to allow the user to enter another meteorological element such as windspeed (e.g. 2.4 mph). (Hint: you will need another array). Note, the user should be able to enter both rainfall and windspeed in your new implementation.-

You will need to update the input data and print data functions. Support your experimentation with screen captures of executing the new code. Submit your code as a separate .txt (or .c )file.

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

4. What happens if you change the NUMMONTHS and NUMYEARS de finitions to other values? Be sure to use both lower and higher values. Describe what happens if you use larger numbers to Declare thearrays. Describe what happens if you use lower numbers to Declare thearrays.

Support your experimentation with screen captures of executing the new code.

Attachment:- Lab_Assignment.rar

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Prepare a new test table with at least 2 distinct test
Reference No:- TGS01661384

Now Priced at $30 (50% Discount)

Recommended (92%)

Rated (4.4/5)