-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcard.cpp
More file actions
106 lines (88 loc) · 2.71 KB
/
Copy pathcard.cpp
File metadata and controls
106 lines (88 loc) · 2.71 KB
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
/*
* card.cpp
* COMP11 Splendor
* Abe Park 11/26/2019
*
* Purpose: Implements a Card class that stores information from the data file
* and returns output given the user's query.
*
*/
#include "card.h"
/* ------------------------------------------------------------------------ */
/* Name: Card (constructor)
* Arguments: string row, int prestige, string discountColor, int price[C_GEMS]
* Description: Stores information passed as arguments from the game.cpp into
* each individual class.
*/
Card::Card() {
row = "";
prestige = 0;
discountColor = "";
for (int i = 0; i < C_GEMS; i++) {
price[i] = 0;
};
}
/* ------------------------------------------------------------------------ */
/* Name: string getRow()
* Arguments: n/a
* Description: getter; returns a 'row' string when called
*/
string Card::getRow() {
return row;
}
/* ------------------------------------------------------------------------ */
/* Name: int getPrestige()
* Arguments: n/a
* Description: getter; returns a 'prestige' int when called
*/
int Card::getPrestige() {
return prestige;
}
/* ------------------------------------------------------------------------ */
/* Name: string getDiscountColor()
* Arguments: n/a
* Description: getter; returns a 'discountColor'string when called
*/
string Card::getDiscountColor() {
return discountColor;
}
/* ------------------------------------------------------------------------ */
/* Name: int getPrice()
* Arguments: int i
* Description: getter; returns a 'price[i]' int when called
*/
int Card::getPrice(int index) {
return price[index];
}
/* ------------------------------------------------------------------------ */
/* Name: void setRow()
* Arguments: string row
* Description: setter; set row to a given string value "row"
*/
void Card::setRow(string row) {
this->row = row;
}
/* ------------------------------------------------------------------------ */
/* Name: void setPrestige()
* Arguments: int prestige
* Description: setter; set prestige to a given int value "price"
*/
void Card::setPrestige(int prestige) {
this->prestige = prestige;
}
/* ------------------------------------------------------------------------ */
/* Name: void setDiscountColor()
* Arguments: string discountColor
* Description: setter; set discountColor to a given string "discountColor"
*/
void Card::setDiscountColor(string discountColor) {
this->discountColor = discountColor;
}
/* ------------------------------------------------------------------------ */
/* Name: void setPrice()
* Arguments: int price, int index
* Description: setter; set price[index] to a given int value "price"
*/
void Card::setPrice(int price, int index) {
this->price[index] = price;
}