Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

create a class that represents the list of baggage cars. <?xml:namespace prefix

ID: 3533834 • Letter: C

Question

create a class that represents the list of baggage cars. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

The specification for CarList.h follows. Use a linked list.

Create the .cpp file to implement the member functions for this class:

class CarList

{

private:

    struct NodeType

    {

        BaggageCar element;

        NodeType* next;

        NodeType (BaggageCar elem, NodeType* link) : element(elem), next(link)

        {}

    }

    NodeType* first;

public:

    CarList();

   //Postcondition: the list has been created and initialized to empty

   

    ~CarList();

   //Postcondition: the entire list has been deleted

    bool printAirline(const string &airline, ostream &out) const;

   //Postcondition: if there is a valid current item object, returns true; else returns false

void insertInOrder(const BaggageCar &object);

    //Postcondition: a new entry has been added to the list and the list remains ordered;

    bool remove(const BaggageCar & object);

    //Precondition: the list is not empty and object is a member of the list

   //Postcondition: object is removed from the list and success flag of true is returned. If

   //remove fails, 0 is returned.

   NodeType* search(const BaggageCar& object);

   //Postcondition: pointer to object is returned if found; else Null is returned

    void printList(ostream &out) const;

    //Precondition: stream is opened successfully

    //Postcondition: list is printed

    //You will also need an assignment operator, a copy constructor and isEmpty function.

}; //end CarList

Explanation / Answer

If nobody answers plz rate me plz plz plz