The Weather Service Bureau department has data representing monthly rainfall for a year and we would like to create a table categorizing each month as rainy (rainfall 20% higher than average) dry (rainfall 25% lower than average) or average. The data file for monthly rain fall is called rainfall.txt.
rainfall.txt
95 100 120 130 135 145 155 185 190 160 130 120
Store the data file in the same folder (lab 6) of your
lab6.cpp.
Output
The year's average monthly rainfall
was 139 mm.
September has the highest rainfall (190 mm).
January has the lowes rainfall (95 mm)
Month Rainfall(mm)
Classification
-------
--------------- --------------
1
95
Dry
2
100
Dry
3
120
Average
4
130
Average
5
135
Average
6
145
Average
7
155
Average
8
185
Rainy
9
190
Rainy
10
160
Average
11
130
Average
12
120
Average
Program Requirements:
Implement the following
functions in the program:
void inputRainfall(int rainFal l[], int size)
The function reads the monthly rainfall from the file rainFall.txt
and stores them in the array rainFall
int calculateAverageRainFall(int rainFall [], int size)
Return the average monthly rainfall
void classifyAndDisplayRainfall(int rainFall[], int months);
Classify and display each month as average, rainy, or dry.
#include<iostream> //for cin and cout
#include<fstream> //for ifstream
#include<iomanip> //for setw
using namespace std;
int average; //to store the average of all rainfalls
//nputRainfall function populates rainFall array
//by reading data from rainfall.txt file
void inputRainfall(int rainFall[], int &size)
{
int i=0;
ifstream in("rainfall.txt");
if(!in){
cout << "Encountered error opening file" << endl;
return;
}
while(in>>i){
rainFall[size] = i;
size += 1;
}
in.close();
}
//calculateAverageRainFall function takes array and size of
array
//and returns the average of all the rainfalls
int calculateAverageRainFall(int rainFall[],int size)
{
int sum=0;
for(int i=0;i<size;i++)
sum += rainFall[i];
return sum/size;
}
//displays the classification
void classifyAndDisplayRainfall(int rainFall[],int months)
{
cout<<setw(6)<<" Month"<<setw(12)<<"
Rainfall(mm)"<<setw(15)<<"
Classification"<<endl;
cout<<" ------ -----------
---------------"<<endl;
for(int i=0;i<months;i++){
cout<<setw(6)<<(i+1)<<setw(12)<<rainFall[i]<<setw(15);
if(rainFall[i]>average*1.2)
cout<<"Rainy";
else if(rainFall[i]<average*0.75)
cout<<"Dry";
else cout<<"Average";
cout<<endl;
}
}
//main function implementation
int main()
{
int rainFall[100],size=0; //rainFall array to store rainfall values
and
//size to store size of array
//calls the three functions
inputRainfall(rainFall,size);
average=calculateAverageRainFall(rainFall,size);
classifyAndDisplayRainfall(rainFall,size);
return 0;
}
//NOTE: rainfall.txt has the same values as shown in the screenshot above in question
//output screenshot

//any query, post in the comment section
The Weather Service Bureau department has data representing monthly rainfall for a year and we would...
Population 1 Female weights Population 2 male weights 128 190 142 145 130 150 133 127 195 165 166 155 112 155 180 180 180 156 155 188 144 220 140 154 143 200 110 210 160 270 125 250 130 180 150 250 145 240 180 170 175 150 108 155 200 195 151 210 170 155 141 165 200 145 185 190 142 234 125 205 130 151 240 153 160 172 120 200 210 130 220 210...
please answer with clear work using decomposition including
season factor
The next page provides the monthly sales data for Joe's Stone Crab. We have been hired to develop a forecasting model that will predict future sales for 2018 using the time-series seasonal adjustment method. Assume that data is only available through the end of 2017 You are also to prepare a 1-2 page report within a Word file that will explain to the owner (Mr. Joe) what is happening with...
How to use C to output this:
indigo1 376 % lab9
Capacity = 4
Capacity = 8
0 5 10 15 20
Capacity = 16
0 5 10 15 20 25 30 35 40
Capacity = 32
0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80
0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105
110 115 120 125...
need help to complete this java program // add appropriate import statements here. // These imports you can leave as is. import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.paint.Color; import javafx.stage.Stage; /** @author yourAccountNameHere */ public class ConnectTheDots extends Application { /* * Do not add code to main(). Add it below in connectTheDots instead. */ public static void main(String[] args) { launch(args); } /*...
QUESTION 7 The data set Beer Large, which can be found in StatCrunch Shared Data Sets, gives the Alcohol, Carbohydrates and Calories for different brands of beer. The explanatory variable is x + Carbohydrates and the response variable is Y - Calories. Use this information to answer: Calculate the correlation between carbohydrates and calories. (4 decimal places) Row vars varo var var 8 var9 var 10 2 الميا ABV 4.1 5.4 4.43 4.13 5.9 4.9 Carbs 2.6 13.7 5.8 5...
Your IT department provided you data on patients that received ER services, their GHHS, and their recovery time. Prepare a report to share with the owners of the facility that will help you make informed decisions about how long you can expect a patients’ recovery time would be based on their GHHS. Based on your findings provide recommendations on your plan moving forward to improve the functioning of your facilities in generating revenue. Prepare a report that addresses each of...
If the two signal handling functions in 3000pc were replaced by one function, would there be any significant loss of functionality? Briefly explain /* 3000pc.c */ 2 3 4 5 6 7 8 #include <stdio.h> 9 #include <stdlib.h> 10 #include <unistd.h> 11 #include <sys/mman.h> 12 #include <errno.h> 13 #include <string.h> 14 #include <sys/types.h> 15 #include <sys/wait.h> 16 #include <semaphore.h> 17 #include <string.h> 18 #include <time.h> 19 20 #define QUEUESIZE 32 21 #define WORDSIZE 16 22 23 const int wordlist_size =...
data: (copy and paste in excel to view columns in alignment)
Sample Repair Time (days)
1 12
2 17
3 9
4 16
5 10
6 18
7 12
8 14
9 15
10 14
11 14
12 8
13 11
14 10
15 8
16 8
17 14
18 12
19 14
20 13
21 12
22 15
23 15
24 10
25 24
26 17
27 13
28 15
29 13
30 15
31 36
32 40
33 ...
so i have my c++ code and ive been working on this for hours
but i cant get it to run im not allowed to use arrays. im not sure
how to fix it thank you for the help
our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses...
I have written my code for an employee management system that stores Employee class objects into a vector, I am getting no errors until I try and compile, I am getting the error: C2679 binary '==': no operator found which takes a right-hand operand of type 'const std::string' (or there is no acceptable conversion). But I am not sure why any help would be great, Thank you! 1 2 3 4 5 6 7 8 9 10 11 12 13...