Question: Flight.cpp + X Flight.h main.cpp Passenger.cpp Passenger.h //Description - Lab 3: C++ Collections #include Flight.h #include #include 10 void Flight: : expandCapacity( ) 11 81

 Flight.cpp + X Flight.h main.cpp Passenger.cpp Passenger.h //Description - Lab 3:C++ Collections #include "Flight.h" #include #include 10 void Flight: : expandCapacity( )11 81 12 mCapacity += 5; 13 14 //Increases the size ofthe dynamic array by 5 elements and will update the objects attributesaccordingly 15 Passenger* newPass = new Passenger [mCapacity ]; 16 for (inti = 0; i 0) 31 32 mCapacity = capacity; 33 mPassengers= new Passenger [ capacity ]; 34 35 36 38 Flight& Flight::operator+=(const Passenger& P) 39 B 40 if (mNoPassengers == mCapacity) 41 expandCapacity

Flight.cpp + X Flight.h main.cpp Passenger.cpp Passenger.h //Description - Lab 3: C++ Collections #include "Flight.h" #include #include 10 void Flight: : expandCapacity( ) 11 81 12 mCapacity += 5; 13 14 //Increases the size of the dynamic array by 5 elements and will update the objects attributes accordingly 15 Passenger* newPass = new Passenger [mCapacity ]; 16 for (int i = 0; i 0) 31 32 mCapacity = capacity; 33 mPassengers = new Passenger [ capacity ]; 34 35 36 38 Flight& Flight: :operator+=(const Passenger& P) 39 B 40 if (mNoPassengers == mCapacity) 41 expandCapacity (); //the function is calling expandCapacity( ) 42 43 //Adding the new passengerPassenger.h Flight.cpp + X Flight.h main.cpp Passenger.cpp 43 //Adding the new passenger 44 mPassengers [ mNoPassengers ] = P; 45 mNoPassengers++; 46 return *this; //will Update the attributes accordingly 47 48 49 Flight: : Flight(const Flight& F) 50 8 51 mNoPassengers = F.mNoPassengers; 52 mCapacity = F.mCapacity; 53 mPassengers = F.mPassengers; 54 55 56 Flight& Flight: :operator=(const Flight& F) 57 81 58 NoPassengers = F.mNoPassengers; 59 mCapacity = F.mCapacity; 60 mPassengers = F.mPassengers; 61 return *this; 62 63 64 Passenger& Flight: :operator(size_t inx) const 65 66 // if the requested index is out of range it will throw an exception 67 if (inx >= mNoPassengers) 68 throw std: :out_of_range("Bad index "); 69 return mPassengers[inx]; 70 71 72 Passenger& Flight: :operator(string match) const 73 81 74 //using for liip - - - -- 75 for (int i = 0; i Users > manin > Downloads > Lab3(4) > Lab3 > C Passenger.h LO 5 #include 7 using namespace std; 8 9 class Passenger 10 11 string mName; 12 size_t mTicketNumber; 13 size_t static mTicketCounter; 14 15 public: 16 17 / /constructors 18 Passenger ( ) ; 19 Passenger (string) ; 20 void display (bool) const; 21 string getName() const; 22 23 24 8Passenger.cpp + x Passenger.h 4 //Description - Lab 3: C++ Collections UT #include "Passenger.h" 6 #include 7 #include 8 9 //mTicketCounter is initialized to the value of 100 10 size_t Passenger: :mTicketCounter = 100; 11 12 13 Passenger : : Passenger ( ) 14 8{ 15 //SETTING mName to "> AND mTicketNumber to 100 16 mName = " "; 17 mTicketNumber = 100; 18 19 20 Passenger: : Passenger (string desc) 21 22 mTicketCounter++; //increment mTicketCounter by one 23 mName = desc; //set the mName to string contained in the incoming parameter desc 24 mTicketNumber = mTicketCounter; //set mTicketNumber to the value stored in mTicketCounter 25 26 27 void Passenger: : display (bool mode = false) const 28 29 if (mTicketNumber > 100) 30 //if ticket number is greater than 100, it will print passenger name and ticket number. 31 cout #include 8 #include "Flight.h" 9 [int main() { 10 cout glist Empty List" gList Full List" alist Full List" clist Empty List" cList Full List" Test Indexing Functionlaity" based collection classes in your testing program. This is an optional task only. Submission To submit your solution, from the File menu in the NetBeans IDE, choose Export Project -> To ZIP. Take note of where the exported zip file is being saved. Submit that zip file to the DC Connect Assignment folder. Note that, unlike previous C++ labs, only one file attachment will be allowed. thom. macdonald@durhamcollege.ca Page 1 of 1 Helpful Unhelpful Ask Expert Tutors

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!