class for rainfall
| 106 | |
| 107 | // class for rainfall |
| 108 | class CityRainFall : public City |
| 109 | { |
| 110 | protected: |
| 111 | double average = 0; // average for calculating |
| 112 | |
| 113 | public: |
| 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 |
| 155 | class CityHumidity : public City |
nothing calls this directly
no outgoing calls
no test coverage detected