-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethods.cpp
More file actions
220 lines (174 loc) · 6.4 KB
/
Copy pathMethods.cpp
File metadata and controls
220 lines (174 loc) · 6.4 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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#include "Carpentry.h"
#define orders 30
#define labour 60
#define SquareNum 5
#define StoolsNum 5
#define PlainNum 5
#define BookshelfNum 5
#define curvTableNum 5
void SquarTable::getSqTableDetails(){
//get square table details
cout<<"\n\tEnter length "
<<"\n\t> ";
cin>>length;
if (length >= 8)
numLegs = 6;
else
numLegs = 4;
}
void Stool::getStoolDetails(){
//get stool diminsions
do {
cout <<"\n\tEnter the radius of stool "
<<"\n\t> ";
cin >>radius;
cout <<"\n\tEnter legs 1 or 4"
<<"\n\t> ";
cin>> numLegs;
}while(!(numLegs == 1 || numLegs == 4));
if (numLegs == 1)
stoolBase = radius / 2;
else
stoolBase == 0;
}
void menu::printTopOrBottom (char firstChar,char lastChar) {
// Print the first character, lines and the last character.
cout << "\t\t" << char (firstChar) << setfill (char(196)) << setw (42) << char (lastChar) << "\n";
}
void menu::printLine (string text) {
// Print an | followed by the string, followed by |.
cout << "\t\t" << char (179) << text << char (179) << "\n";
}
// Output the menu.
void menu::print () {
// Print the main menu options
bool OK;
cout << "\n\n";
do {
printTopOrBottom (218, 191);
printLine (" CARPENTRY COSTING ");
printLine (" _________________________________ ");
printLine (" ");
printLine (" ");
printLine (" 1 Plain Table Curved Table 2 ");
printLine (" ");
printLine (" 3 Coffee Table Stool 4 ");
printLine (" ");
printLine (" 5 Bookshelf Collect Order 6 ");
printLine (" ");
printLine (" 7 Exit ");
printLine (" ");
printTopOrBottom (192, 217);
cout << "\n\n\t\t\t\t> ";
cin >> choice;
OK = validate (choice);
if (!OK)
cout << "\a\a\n\n\t" << choice << " is not a valid choice. Please reenter when prompted.\n\n\n";
}
while (!OK);
}
bool menu::validate (char choice) {
// Accept choice and return true if valid, false if invalid.
return (choice >= '1' && choice <= '7' || toupper(choice) =='L');
}
void RectTable::getRecTableDetails(){
//get details for plain table
cout <<"\n\tEnter length of table "
<<"\n\t> ";
cin >>length;
cout <<"\n\tEnter width of table "
<<"\n\t> ";
cin >>width;
if (length >= 8)
numLegs = 6;
else
numLegs = 4;
}
void bookShelf::getBookDetails(){
//Get details for boookshelf
cout <<"\n\tEnter height "
<<"\n\t> ";
cin >>height;
cout <<"\n\tEnter width "
<<"\n\t> ";
cin >>width;
cout <<"\n\tEnter width of sides "
<<"\n\t> ";
cin >>side;
cout <<"\n\tEnter amount of shelves requried "
<<"\n\t> ";
cin >>shelves;
}
void furniture::placeOrder(){
//place customer order
bool yes;
do{
cout <<"\n\tDo you want to place this order Y/N \n"
<<"\n\t> ";
cin >>order;
yes = valid(order);
if (!yes)
cout << "\a\a\n\n\t" << order << " is not a valid choice. Please re-enter when prompted.\n\n\n";
}while(!yes);
}
bool furniture::valid (char order) {
// Accept choice and return true if valid, false if invalid.
return (toupper(order) == 'Y' || toupper(order) == 'N');
}
void customer::getCustomerDetails(){
//If order is true, then get customer details
custNo = CustomerNo;
orderNo = CurrentOrders;
cin.ignore();
cout << "\n\tEnter your name "
<<"\n\t> ";
getline(cin, name, '\n');
cout <<"\n\tEnter your address "
<<"\n\t> ";
getline(cin, address, '\n');
cout <<"\n\tEnter your phone number "
<<"\n\t> ";
cin >>phone;
}
void furniture::printOrder(){
//print order details to console
cout << "\n\tCustomer Number: "<<"\t"<< CustomerNo <<"\n"
<< "\n\t--------------------------------------------"
<< "\n\n\tCustomer Name: "<<"\t\t"<<name
<< "\n\t--------------------------------------------"
<< "\n\n\tCustomer Address: "<<"\t"<<address
<< "\n\t--------------------------------------------"
<< "\n\n\tContact Number: "<<"\t"<<phone
<< "\n\t--------------------------------------------"
<< "\n\n\tItem Details: "<<"\t\t" <<itemDetail
<< "\n\t--------------------------------------------"
<< "\n\n\tCost before taxes: "<<"\t" <<cost
<< "\n\t--------------------------------------------"
<< "\n\n\tVat @ 21% "<<"\t\t" <<vat
<< "\n\t--------------------------------------------"
<< "\n\n\tTotal cost: "<<"\t\t" <<totalCost
<< "\n\t--------------------------------------------"
<< "\n\n\tEND OF FILE \n\n";
}
void furniture::AllOrders(){
//Store all orders to text file
ofstream AllOrders("CustomerOrders.txt", ios::app);
AllOrders << "\n\tCustomer Number: "<<"\t"<< CustomerNo <<"\n"
<< "\n\t--------------------------------------------"
<< "\n\n\tCustomer Name: "<<"\t\t"<<name
<< "\n\t--------------------------------------------"
<< "\n\n\tCustomer Address: "<<"\t"<<address
<< "\n\t--------------------------------------------"
<< "\n\n\tContact Number: "<<"\t"<<phone
<< "\n\t--------------------------------------------"
<< "\n\n\tItem Details: "<<"\t\t" <<itemDetail
<< "\n\t--------------------------------------------"
<< "\n\n\tCost before taxes: "<<"\t" <<cost
<< "\n\t--------------------------------------------"
<< "\n\n\tVat @ 21% "<<"\t\t" <<vat
<< "\n\t--------------------------------------------"
<< "\n\n\tTotal cost: "<<"\t\t" <<totalCost
<< "\n\t--------------------------------------------"
<< "\n\n\tEND OF FILE \n\n";
AllOrders.close();
}