Question: in c++ format please the code below needs to be revised and filled in with the post and pre conditions in the requirements requirements: Update

in c++ format please

the code below needs to be revised and filled in with the post and pre conditions in the requirements

requirements:

Update the comments for each prototype by filling in the pre and post conditions.

Remember that pre conditions indicate what conditions must be met BEFORE the user calls the function. The function will not work properly unless the pre conditions are met.

Post conditions indicate what will be the result of the function call. In other words, what conditions will exist after the function is called.

code provided:

#include //for NULL class List { private: struct Node { int data; Node* next; Node(int data): data(data), next(NULL){} }; typedef struct Node* Nodeptr; Nodeptr first; Nodeptr last; int size; public: /**Constructors and Destructors*/ List(); //Default constructor; initializes and empty list //Postcondition: ~List(); //Destructor. Frees memory allocated to the list //Postcondition: /**Accessors*/ int getFirst(); //Returns the first element in the list //Precondition: int getLast(); //Returns the last element in the list //Precondition: bool isEmpty(); //Determines whether a list is empty. int getSize(); //Returns the size of the list /**Manipulation Procedures*/ void removeLast(); //Removes the value of the last element in the list //Precondition: //Postcondition: void removeFirst(); //Removes the value of the first element in the list //Precondition: //Postcondition: void insertLast(int data); //Inserts a new element at the end of the list //If the list is empty, the new element becomes both first and last //Postcondition: void insertFirst(int data); //Inserts a new element at the start of the list //If the list is empty, the new element becomes both first and last //Postcondition: /**Additional List Operations*/ void printList(); //Prints to the console the value of each element in the list sequentially //and separated by a blank space //Prints nothing if the list is empty };

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 Databases Questions!