How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Scott Your Own Question
Scott
Scott, MIT Graduate
Category: Homework
Satisfied Customers: 3040
Experience:  MIT Graduate (Math, Programming, Science, and Music)
3546829
Type Your Homework Question Here...
Scott is online now
A new question is answered every 9 seconds

Modify the program to add a function to sum the rainfall for

Customer Question





  1. 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.




  2. 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.




  3. 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.




  4. 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.







// 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","May","Jun","Jul","Aug","Sep","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 dataprintdata(); }

else {
printf("No data was input at this time\n");

}
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 dataprintf ("year\t month\t rain\n"); for (int year=0;year < NUMYEARS; year++) {

for (int month=0; month< NUMMONTHS; month++) { printf("%s\t %s\t %5.2f\n",

years[year],months[month],Raindata[year][month]); }

} }







Submitted: 7 months ago.
Category: Homework
Expert:  John replied 7 months ago.
hithanks for your question in justAnswer.comMy name is ***** ***** will help youWhen is due this

Related Homework Questions