50 Tom, David, Jeremy, Ron,
54 Marilyn, Carolyn, Cathy,
55 Inez, Jean, Heather, Juliet
57 const int noOfEmployees = Juliet+1;
69 const char* employeeToName(Employee e);
70 extern const int stewards[];
71 extern const int noOfStewards;
72 extern const int hostesses[];
73 extern const int noOfHostesses;
74 extern const int spanishSpeaking[];
75 extern const int noOfSpanishSpeaking;
76 extern const int frenchSpeaking[];
77 extern const int noOfFrenchSpeaking;
78 extern const int germanSpeaking[];
79 extern const int noOfGermanSpeaking;
80 extern const Flight requiredCrew[];
81 extern const int noOfFlights;
101 :
Script(
opt), flight(*this,noOfFlights,
IntSet::empty,0,noOfEmployees-1) {
102 IntSet stewardsDS(stewards,noOfStewards);
103 IntSet hostessesDS(hostesses,noOfHostesses);
104 IntSet spanishDS(spanishSpeaking, noOfSpanishSpeaking);
105 IntSet frenchDS(frenchSpeaking, noOfFrenchSpeaking);
106 IntSet germanDS(germanSpeaking, noOfGermanSpeaking);
108 for (
int i=0;
i<noOfFlights;
i++) {
114 requiredCrew[
i].stewards);
116 requiredCrew[
i].hostesses);
118 requiredCrew[
i].spanish);
120 requiredCrew[
i].french);
122 requiredCrew[
i].german);
126 for (
int i=0;
i<noOfFlights-2;
i++) {
127 rel(*
this, flight[
i] || flight[
i+1]);
128 rel(*
this, flight[
i] || flight[
i+2]);
130 rel(*
this, flight[noOfFlights-2] || flight[noOfFlights-1]);
138 for (
int i=0;
i<noOfFlights;
i++) {
139 os <<
"\tFlight " <<
i+1 <<
":" << std::endl;
140 os <<
"\t\tCrew\tStew.\tHost.\tFrench\tSpanish\tGerman"
141 << std::endl <<
"\t";
142 os <<
"\t" << requiredCrew[
i].staff <<
"\t" << requiredCrew[
i].stewards
143 <<
"\t" << requiredCrew[
i].hostesses <<
"\t"
144 << requiredCrew[
i].spanish
145 <<
"\t" << requiredCrew[
i].french <<
"\t" << requiredCrew[
i].german
148 os <<
"\t\tSchedule:" << std::endl <<
"\t\t";
151 os << employeeToName(static_cast<Employee>(
d.val())) <<
" ";
154 os <<
"\tRequired: ";
156 os << employeeToName(static_cast<Employee>(
d.val())) <<
" ";
158 os << std::endl <<
"\t\t\tPossible: ";
160 os << employeeToName(static_cast<Employee>(
d.val())) <<
" ";
163 os << std::endl << std::endl;
175 return new Crew(share,*
this);
188 Script::run<Crew,DFS,Options>(o);
196 employeeToName(Employee e) {
198 case Tom :
return "Tom";
199 case David :
return "David";
200 case Jeremy:
return "Jeremy";
201 case Ron:
return "Ron";
202 case Joe:
return "Joe";
203 case Bill:
return "Bill";
204 case Fred:
return "Fred";
205 case Bob:
return "Bob";
206 case Mario:
return "Mario";
207 case Ed:
return "Ed";
208 case Carol:
return "Carol";
209 case Janet:
return "Janet";
210 case Tracy:
return "Tracy";
211 case Marilyn:
return "Marilyn";
212 case Carolyn:
return "Carolyn";
213 case Cathy:
return "Cathy";
214 case Inez:
return "Inez";
215 case Jean:
return "Jean";
216 case Heather:
return "Heather";
217 case Juliet:
return "Juliet";
224 const int stewards[] =
225 {Tom, David, Jeremy, Ron, Joe, Bill, Fred, Bob, Mario, Ed};
227 const int noOfStewards =
sizeof(stewards) /
sizeof(
int);
229 const int hostesses[] =
230 { Carol, Janet, Tracy, Marilyn, Carolyn, Cathy, Inez,
231 Jean, Heather, Juliet };
233 const int noOfHostesses =
sizeof(hostesses) /
sizeof(
int);
235 const int frenchSpeaking[] =
236 { Bill, Inez, Jean, Juliet };
238 const int noOfFrenchSpeaking =
sizeof(frenchSpeaking) /
sizeof(
int);
240 const int germanSpeaking[] =
241 { Tom, Jeremy, Mario, Cathy, Juliet };
243 const int noOfGermanSpeaking =
sizeof(germanSpeaking) /
sizeof(
int);
245 const int spanishSpeaking[] =
246 { Joe, Bill, Fred, Mario, Marilyn, Inez, Heather };
248 const int noOfSpanishSpeaking =
sizeof(spanishSpeaking) /
sizeof(
int);
251 const Flight requiredCrew[] =
264 const int noOfFlights =
sizeof(requiredCrew) /
sizeof(Flight);