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

Class CityTemperature

Lab_21/city_temperature_control.cpp:60–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58};
59
60class CityTemperature : public City
61{
62protected:
63 double average = 0;
64
65public:
66
67 void setClimateData() {
68 average = 0;
69 City::input();
70
71 cout << "Enter Temperature Degree: " << endl;
72
73 for (int i = 0; i < 12; i++) {
74 cout << i+1 << " Month: ";
75
76 cin >> cityClimateDate[i];
77 // validation check
78 if (cityClimateDate[i] > -60 && cityClimateDate[i] < 60) {
79 average = average + cityClimateDate[i];
80 }
81 else {
82 cout << "Please check your input! " << endl;
83 i--; // checking and returning
84 }
85 } // for ends
86
87 }
88
89 // for displaying from file
90 void getClimateData() {
91
92 City::GetData();
93
94 int array = 0;
95 for (int i = 0; i < 4; i++) {
96 for (int j = 0; j < 3; j++) {
97 cout << cityClimateDate[array] << " ";
98 array++;
99 }
100 }
101 // claculating the average temperature
102 cout << "\nAverage Temperature: " << average / 12.0 << endl << endl;
103 array = 0;
104 }
105};
106
107// class for rainfall
108class CityRainFall : public City

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected