Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

I can’t figure out the error in this code to save my life. Plz help…

I can’t figure out the error in this code to save my life. Plz help…

I’ve attached what I’ve done as well as the homework assignment. Just need help with #3.

TIA!

#define NUMMONTHS 12
#define NUMYEARS 5
#include <stdio.h>
// function prototypes
void inputdata();
void printdata();
void inputwindspeed();
// 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”};
float sumRainfall[NUMYEARS];
float windspeed[NUMYEARS][NUMMONTHS];
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 input windspeed
inputwindspeed();

// Call Function to display data
printdata();
}
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++) {
sumRainfall[year]=0.0;
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;
sumRainfall[year] += Rain;
}
}
}

// Function for windspeed data input
void inputwindspeed() {
/*variable definition: */
float windspeed = 1.0;
//input data
for (int year=0;year < NUMYEARS; year++) {
for (int month=0;month < NUMMONTHS; month++) {
printf(“Enter windspeed for %d, %d:\n”, year+1, month+1);
scanf(“%f”,&windspeed);
}
}
}

// Function to printdata
void printdata() {
// Print data
printf (“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\t %5.2f\n”,
years[year],months[month],Raindata[year][month], windspeed[year][month]);
}
//printing sum of rainfall for the year
printf(“Total rainfall for this year: %5.2f\n”, sumRainfall[year]);
}
}
}

Jennifer LagumenCMIS 10225 July 2017Week 8 Hands-On LabTest PlanTo verify this program is working properly the input values could be used for testing:Test CaseInputExpected Output
Background image of page 01
1Enter data? = y1.22.23.32.210.212.22.30.40.21.12.10.41.12.23.32.210.212.22.30.40.21.12.10.41.12.23.32.210.212.22.30.40.21.12.10.41.12.23.32.210.212.22.3YearMonthRain2011Jan1.202011Feb2.202011Mar3.302011Apr2.202011May10.202011Jun12.202011Jul2.302011Aug0.402011Sep0.202011Oct1.102011Nov2.102011Dec0.402012Jan1.102012Feb2.202012Mar3.302012Apr2.202012May10.202012Jun12.202012Jul2.302012Aug0.402012Sep0.20
Background image of page 02

Show 

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"