-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththe1990s.cpp
167 lines (146 loc) · 5.08 KB
/
the1990s.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/***********************************************************
**CLASS: THE1990S
**
**DESCRIPTION: CPP FILE
**
**A derived class of the Era class. The1990s has a message,
**lyric and song from that decade.
***********************************************************/
#include "the1990s.hpp"
/*************************************************************
**Function: The1990s()
**Description: Constructor sets year to "1990s"
**Parameters: N/A
**Pre-Conditions: N/A
**Post-Conditions: N/A
*************************************************************/
The1990s::The1990s(): Era() {
year = "1990s";
}
/*************************************************************
**Function: The1990s(string, Era *&, Era *&, Era *&, Era *&)
**Description: Constructor uses parameters, sends them
**to set methods.
**Parameters: string (year), Era * & (forward),
**Era * & (backward), Era * & (itself), Era * & (secret)
**Pre-Conditions: N/A
**Post-Conditions: Era's 4 pointers will be assigned to
**point to the Era's passed by reference
*************************************************************/
The1990s::The1990s(string year, Era * &forw, Era * &back, Era * &it, Era * &secret): Era(year, forw, back, it, secret)
{
//SETS INHERITED MEMBERS:)
}
/*************************************************************
**Function: ~The1990s()
**Description: Destructor deletes pointers forward,
**backward, itself and secretPassage
**Parameters: N/A
**Pre-Conditions: N/A
**Post-Conditions: N/A
*************************************************************/
The1990s::~The1990s() {
delete forward;
delete backward;
delete itself;
delete secretPassage;
}
/*************************************************************
**Function: message()
**Description: Displays message from the 1990s, describing
**this era
**Parameters: N/A
**Pre-Conditions: N/A
**Post-Conditions: N/A
*************************************************************/
void The1990s::message() {
cout << "You are in the decade of the..." << this->year <<endl;
cout << "Plaid, windbreakers, boy bands, the term 'wassup', & Saved by the Bell gallore!" <<endl <<endl;
}
/*************************************************************
**Function: lyric()
**Description: Allows user to guess correct lyric of
**a song from the 1990s. If they guess correct, function
**returns true, else it returns false.
**Parameters: N/A
**Pre-Conditions: N/A
**Post-Conditions: N/A
*************************************************************/
bool The1990s::lyric() {
bool guessedCorrect = false;
int guess;
cout << "In order to collect an item you need to guess the correct lyric" <<endl;
cout << "We'll use a famous song from the 90's" <<endl <<endl;
cout << "'My loneliness is killing me(and I), I must confess, " <<endl;
cout << "I still believe(still believe)!" <<endl;
cout << "When I'm not with you I lose my mind, give me a sign, " <<endl;
cout << "hit me _______ one more time" <<endl <<endl;
cout << "Please enter your choice: " <<endl;
cout << "1. love" <<endl;
cout << "2. again" <<endl;
cout << "3. baby" <<endl;
cin >> guess;
cin.ignore();
if(guess == 3) {
guessedCorrect = true;
cout << "You guessed correct!" <<endl;
return true;
}
else {
cout << "Incorrect. Try again..." <<endl;
return guessedCorrect;
}
}
/*************************************************************
**Function: collect()
**Description: Uses random generator to pick an item that
**the user can collect if they wish
**Parameters: N/A
**Pre-Conditions: N/A
**Post-Conditions: N/A
*************************************************************/
string The1990s::collect() {
string item;
int type;
type = rand()%8 + 1;
if(type ==1) {
item = "Mom";
}
else if(type ==2) {
item = "Dad";
}
else if(type ==3) {
item = "Prom_Tickets";
}
else if(type ==4) {
item = "Hoverboard";
}
else if(type ==5) {
item = "Clock";
}
else if(type ==6) {
item = "Doc";
}
else if(type ==7) {
item = "Photograph";
}
else if(type ==8) {
item = "Einstein";
}
return item;
}
/*************************************************************
**Function: song()
**Description: Dislpays lyrics to a famous song from the
**1990s.
**Parameters: N/A
**Pre-Conditions: N/A
**Post-Conditions: N/A
*************************************************************/
void The1990s::song(){
cout << "Now let's play a song from this era and see if any sparks fly..." <<endl <<endl;
cout << "Tell me why, ain't nothin' but a heartache" << endl;
cout << "Tell me why, ain't nothin' but a mistake" <<endl;
cout << "Tell me why, I never want to hear you say" <<endl;
cout << "I want it that way!" <<endl <<endl;
}