-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSeasons.cpp
63 lines (52 loc) · 1.73 KB
/
Seasons.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "Seasons.h"
#include <iostream>
using namespace std;
bool Seasons::Scheck = false;
std::string Seasons::currentSeason = ""; // Initialize the current season as an empty string
void Seasons::SetTimeStep(bool check) {
Scheck = check;
}
std::string Seasons::getCurrentSeason() { // get the current season
return currentSeason;
}
void Seasons::setCurrentSeason(std::string newSeason) { // set the season
currentSeason = newSeason;
}
void Seasons::SeasonCheck(int timeStep) {
// Calculate the current time step within the cycle
int currentStep = timeStep % 20;
// Check for the current season based on the current time step
if (currentStep >= 0 && currentStep < 5) {
setCurrentSeason("Spring");
Spring();
} else if (currentStep >= 5 && currentStep < 10) {
setCurrentSeason("Summer");
Summer();
} else if (currentStep >= 10 && currentStep < 15) {
setCurrentSeason("Autumn");
Autumn();
} else {
setCurrentSeason("Winter");
Winter();
}
}
void Seasons::Summer() { // Implement summer-like weather conditions here
if (Scheck) {
cout << "It's very warm and the sun is out.\n";
}
}
void Seasons::Autumn() { // Implement autumn-like weather conditions here
if (Scheck) {
cout << "The weather is chilly and foggy, and leaves are changing color.\n";
}
}
void Seasons::Winter() { // Implement winter-like weather conditions here
if (Scheck) {
cout << "Its snowing all day and there's slight ice on the roads.\n";
}
}
void Seasons::Spring() { // Implement spring-like weather conditions here
if (Scheck) {
cout << "It's getting warmer and flowers are beginning to bloom again.\n";
}
}