MCPcopy Create free account
hub / github.com/Rustam-Z/cpp-programming / CityRainFall

Class CityRainFall

Lab_21/city_temperature_control.cpp:108–152  ·  view source on GitHub ↗

class for rainfall

Source from the content-addressed store, hash-verified

106
107// class for rainfall
108class CityRainFall : public City
109{
110protected:
111 double average = 0; // average for calculating
112
113public:
114
115 void setClimateData() {
116 average = 0;
117 City::input();
118
119 cout << "Enter Rainfall Degree: " << endl;
120
121 for (int i = 0; i < 12; i++) {
122 cout << i+1 << " Month: ";
123
124 cin >> cityClimateDate[i];
125
126 if (cityClimateDate[i] > 0 && cityClimateDate[i] < 300) {
127 average = average + cityClimateDate[i];
128 }
129 else {
130 cout << "Please check your input! " << endl;
131 i--; // checking and returning
132 }
133 } // for ends
134
135 }
136
137 void getClimateData() {
138
139 City::GetData();
140
141 int array = 0;
142 for (int i = 0; i < 4; i++) {
143 for (int j = 0; j < 3; j++) {
144 cout << cityClimateDate[array] << " ";
145 array++;
146 }
147 ;
148 }
149 cout << "\nAverage Rainfall: " << average / 12.0 << endl << endl;
150 array = 0;
151 }
152};
153
154// class for humodity
155class CityHumidity : public City

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected