-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathList.h
75 lines (56 loc) · 2.12 KB
/
List.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* 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?)
*
* Author: Michael Chang
* Date: January 22, 2019
*/
#pragma once
// You can add #include statements if you wish.
#include <string>
#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);
// Description: Prints out each patient's data
void printEverything();
}; // end List.h