Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is a C++ program about link list, please help me complete the codes, thanks!(the .h file has been provided) /* * List.h * *
This is a C++ program about link list, please help me complete the codes, thanks!(the .h file has been provided)
/* * List.h * * Class Description: List data collection ADT. * Class Invariant: Data collection with the following characteristics: * - Each element is unique (no duplicates). * - (What other characteristic does our List have?) * * * */ #pragma once // You can add #include statements if you wish. #include#include "Patient.h" using namespace std; class List { private: /* * You can add more attributes to this class, * but you cannot remove the attributes below * nor can you change them. */ static const int MAX_ELEMENTS = 5; // Small capacity so can test when data collection becomes full // ***As we are testing the code of our assignment, we can // change the value given to this constant.*** Patient elements[MAX_ELEMENTS]; // Data structure with capacity of MAX_ELEMENTS int elementCount; // Current element count in element array int capacity; // Actual maximum capacity of element array public: /* * You can add more methods to this interface, * but you cannot remove the methods below * nor can you change their prototype. * */ // Default constructor List(); // Description: Returns the total element count currently stored in List. int getElementCount() const; // Description: Insert an element. // Precondition: newElement must not already be in data collection. // Postcondition: newElement inserted and elementCount has been incremented. bool insert(const Patient& newElement); // Description: Remove an element. // Postcondition: toBeRemoved is removed and elementCount has been decremented. bool remove( const Patient& toBeRemoved ); // Description: Remove all elements. void removeAll(); // Description: Search for target element. // Returns a pointer to the element if found, // otherwise, returns NULL. Patient* search(const Patient& target); }; // end List.h
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started