Description
I would need help with my C++-coding project. It is about a hospital management system and the code is done about 50-60%. There should be added some commands and check that the requirements are matched. The needed files are added in the description. The description seems long, but the main thing is to follow requirements and add following commands, enter, leave, assign_staff, print_patient_info, print_care_periods, print_all_medicines, print_all_patients, print_current_patients.
Unformatted Attachment Preview
(Hospital)
Objective: I am learning about modularity in object-oriented programming and how classes
(objects) can be interconnected. I practice reading existing code, using pointers, and
managing dynamic memory. At the same time, I’m revisiting the containers in STL.
Considering how to divide the program into parts using functions and classes is also
advisable.
Note
This project is done as independent work. Collaborative work is not allowed and will be
considered plagiarism.
Implement a ready program that, upon starting, reads commands given by the user.
Depending on the command, the program either stores data in an appropriate data structure,
deletes them, or performs searches in that data structure.
Description of the program’s operation
The program includes the classes Hospital, CarePeriod, Person, Date, and Cli, as well as the
Utils module.
Objects of the Person class can be either patients or hospital staL (but not both). The staL are
not further diLerentiated, for example, not divided into doctors and nurses. Names (as done
in the example runs below) or any string can be used for identifying persons.
The hospital staL is permanent. Once recruited, members remain on the staL until the end of
the program. (The program has a recruitment command but no command for removing staL.)
Patients can be added and removed. When a patient is added, a new care period is also
created, and all created care periods remain until the end of the program. The same patient
can have multiple care periods during the program. In other words, the same patient can enter
and leave the hospital several times during the program.
The CarePeriod class describes a single patient’s single care period, but as mentioned above,
the same patient can have multiple care periods. A care period has at least a start date, and
ended care periods also have an end date. In addition to the patient, the care period includes
0-n members of the staL. The same person can be an employee on several (the same
patient’s or diLerent patients’) care periods.
Patients can also have medications. In the program, a medicine is described as a record
(struct) and not as a class, because the medicine does not have any operations. This record is
found in the Person class. Medications are patient-specific, and they remain from one care
period to another. When (and only when) a patient is on a care period in the hospital,
medications can be added or removed for them, but when the care period ends, the patient
retains those medications that have been prescribed and have not been removed. On the
other hand, staL members who have treated the patient are specific to the care period, and
diLerent people (or the same people) can treat the patient on diLerent care periods.
The Cli class (command line interpreter) describes the command interpreter, i.e., it manages
the commands used in the program. The Utils module provides a few general-purpose
functions. No changes need to be made to either of these (Cli or Utils). For example, these
modules check whether the user provides the correct number and type of parameters for a
command. The checks have been implemented already, so you don’t need to worry about
them.
The Hospital class manages the entire program, and only one object of it is created. The
hospital has patients, staL, and care periods.
An arrow is drawn from class A to class B if class A knows class B. In this case, class A has an
instance (or pointer to) of class B as an attribute. The Cli class and the Utils module are left
out of the image because they are helper modules and do not actually belong to the hospital
system. Clarifications are written on the arrows where necessary, which may help understand
why the connection is needed.
The birthday arrow in the image is dashed because such a connection could very naturally
exist, but it is not actually used in the program.
As mentioned earlier, the same person can appear in several diLerent places. For example,
the same patient can be on several care periods, and the same person can work on several
care periods. Therefore, you need pointers. Each person is created only once, and when/if a
person is needed in diLerent places, a pointer to that person is used.
General information about commands
The program has quite a few commands, but your task is to implement only about half of
them.
The program does not have an input file, so initially, the hospital is empty, i.e., there are no
staL or patients. Additions (as well as deletions) are made with commands. Among the
commands is READ_FROM, which reads the commands from a given file (see command 3 of
the commands already implemented).
When the program starts and whenever input from the user is awaited, the following prompt is
printed:
Hosp>
The program user can enter commands at this prompt (or just press the Enter key).
Commands can be written in uppercase or lowercase letters, or using a mix of both. Thus, the
allowed forms of the quit command, for example, are QUIT, quit, and Quit. The commands
also have abbreviations, which are listed with the HELP command. For example, the
abbreviation for the quit command is Q (or q if written in lowercase).
Each command has a set number of parameters. The parameters appear within angle
brackets in the description of each command. If a parameter consists of more than one word,
it should be written inside quotation marks. If there are too many or too few parameters, an
error message is printed:
Error: Wrong amount of parameters.
The check for the number of parameters is implemented in the base code, so you don’t need
to worry about it.
If the user enters a command other than those known by the program, an error message is
printed:
Hosp> something
Error: Unknown commands given.
Hosp>
Hosp>
After the user’s entered command has been executed, the program prints the prompt again.
This continues until the user enters the QUIT command.
If the user simply presses the Enter key without giving any command, the prompt is printed
again, as shown in the last example. In this sense, the program operates like the command
line of a Linux remote desktop.
The following two sections first describe the implemented commands and then the
commands to be implemented. Naturally, the first of these sections does not need to be read
very carefully, as it suLices to know how to use the commands. The latter section, however,
should be read carefully, as your task is to implement these commands.
Implemented commands with error messages
QUIT – The program execution ends with the return value EXIT_SUCCESS without the program
printing anything. The command does not have parameters, but if the user provides
parameters, they are not considered.
HELP – The command prints all the available commands with their abbreviations. Each line
first shows the command description and then the command and its abbreviation after a
colon:
Hosp> HELP
Recruit staL : RECRUIT R
Take patient to hospital : ENTER E
Take patient from hospital : LEAVE L
Assign staL for a patient : ASSIGN_STAFF AS
Add medicine for a patient : ADD_MEDICINE AM
Remove medicine from a patient : REMOVE_MEDICINE RM
Print patient’s info : PRINT_PATIENT_INFO PPI
Print care periods per staL : PRINT_CARE_PERIODS PCPS
Print all used medicines : PRINT_ALL_MEDICINES PAM
Print all staL : PRINT_ALL_STAFF PAS
Print all patients : PRINT_ALL_PATIENTS PAP
Print current patients : PRINT_CURRENT_PATIENTS PCP
Set date : SET_DATE SD
Advance date : ADVANCE_DATE AD
Read : READ_FROM RF
Help : HELP H
Quit : QUIT Q
Hosp>
READ_FROM – This command can read the commands with their parameters from a
given file, which can facilitate testing of the program. Along with the base codes, you receive
the file assignment.input, which contains commands appearing in the example runs. The file
uses the command abbreviations. The content of the file is as follows:
This file can be given to the read command as a parameter as follows:
This way, you can execute all the successful commands contained in the file faster than if you
wrote them one by one after the prompt.
Note that the file assignment.input also contains commands that are not implemented in the
base code.
If a command in the file is incorrect, for example, if there are the wrong number of
parameters, no error message is printed, as would be the case from the command line. Also,
the file must have the command QUIT (or its abbreviation) as the last command; otherwise,
reading the file will never end. Therefore, follow the instructions above if you are using your
own input file to test the program. Testing the program (in one way or another) is highly
recommended.
If an unknown file is given as a parameter for the command, an error message is printed:
Hosp> READ_FROM not_found.txt
Error: Can’t read given file.
After this, the program ends with the return value EXIT_SUCCESS.
SET_DATE – This command can be used to set a new date as dd.mm.yyyy.
(The current date has been set to 24.2.2024 in the file utils.hh, and if you want, you can
change it in the code, but this command does the same thing.) The command has three
integer parameters. If the day (or month) is numerically 1, it can be given either as 1 or 01, and
the same applies to other single-digit numbers. For example:
If a parameter is given as too large a number that does not fit as a day or month, the
respective number is set to 1. For example:
If any of the parameters are anything other than a positive integer, the program prints an error
message:
ADVANCE_DATE – This command can be used to move the current
date forward by the number of days given as a non-negative integer parameter. If zero is given
as the parameter for the command, the current date can be found out. For example:
The actual shifting happens as follows:
If something other than a non-negative integer is given as a parameter, an error message is
printed:
RECRUIT – This command can be used to add a new member to the hospital staL. The
identifier, for example, a name, is given as a parameter. (The given identifier can be used as a
parameter in other commands.) An example of adding a staL member:
If a person with the same name is already on the staL, an error message is printed:
PRINT_ALL_STAFF – This command prints all the staL recruited to the hospital. The members
are printed in alphabetical order one below the other. If there are no staL members, None is
printed. For example:
ADD_MEDICINE – This command can be
used to add a medicine for a patient, specifying its strength (in milligrams) and dosage as
integers.
Medicines can only be prescribed for patients currently in the hospital. In the following
examples, it’s assumed that Pekka is a patient in the hospital:
If the patient has already been prescribed the medicine, the command can be used to change
the prescription (strength and/or dosage). If the entire prescription (name, strength, dosage) is
the same as what the patient had previously, nothing happens, and no error message is given.
For example:
If the strength or dosage is given as something other than integers, an error message is
printed:
If the patient given as a parameter is not found (they are not in the hospital at that moment),
an error message is printed:
REMOVE_MEDICINE – This command can be used to remove a
medicine from a patient. Medicines can only be removed from patients currently in the
hospital. In the examples below, it’s assumed that Pekka is a patient in the hospital:
If the medicine has not been prescribed to the patient, nothing happens, and no error
message is given. For example:
If the patient given as a parameter is not found (they are not in the hospital at that moment),
an error message is printed:
Commands to be implemented with error messages
ENTER – This command can be used to admit a new patient to the hospital. The identifier,
for example, the patient’s name, is given as a parameter. (The given identifier can be used as a
parameter in other commands.) An example of admitting a patient:
Hosp> ENTER Pekka
A new patient has entered.
Hosp>
When a patient arrives at the hospital, a new care period is also created, with its start date set
to the current value of the today variable in the Utils module.
If a patient with the same name is already present, an error message is printed:
Hosp> ENTER Pekka
A new patient has entered.
Hosp> ENTER Pekka
Error: Already exists: Pekka
Hosp>
However, if the patient leaves the hospital in the meantime (with the LEAVE command), they
can be readmitted (for a new care period). In such a case, a new patient is not created, but the
program must retain information about all patients who have ever been in the hospital.
However, it’s suLicient to retain only the information generated during the same run of the
program. If the program is restarted, there are initially no staL or patients in the hospital.
A new care period is created regardless of whether the patient has previously been in the
hospital.
LEAVE – This command can be used to discharge a patient from the hospital, but
information about their care period is retained (dates and staL). For example:
Hosp> LEAVE Pekka
Patient left hospital, care period closed.
Hosp>
When a patient leaves the hospital, their current care period ends, and the end date can be
set to the current date.
If the patient to be discharged is not found (they are not currently in the hospital), an error
message is printed:
Hosp> LEAVE Pekka
Patient left hospital, care period closed.
Hosp> LEAVE Pekka
Error: Can’t find anything matching: Pekka
Hosp>
The following example shows how a patient can first come to the hospital, then leave, and
come back again:
Hosp> ENTER Pekka
A new patient has entered.
Hosp> ENTER Pekka
Error: Already exists: Pekka
Hosp> LEAVE Pekka
Patient left hospital, care period closed.
Hosp> ENTER Pekka
A new patient has entered.
Hosp>
ASSIGN_STAFF – This command can be used to assign the
given staL member to work on the current care period of the given patient. For example:
Hosp> ENTER Pekka
A new patient has entered.
Hosp> RECRUIT Jussi
A new staL member has been recruited.
Hosp> ASSIGN_STAFF Jussi Pekka
StaL assigned for: Pekka
Hosp>
If the same staL member is tried to be assigned to the same patient again, nothing happens,
and no error message is given:
Hosp> ASSIGN_STAFF Jussi Pekka
StaL assigned for: Pekka
Hosp> ASSIGN_STAFF Jussi Pekka
StaL assigned for: Pekka
In the following example, it’s assumed that the above commands have been executed first. If
the staL member or the patient is not found, the program prints the error message shown
below:
Hosp> ASSIGN_STAFF Jukka Pekka
Error: Can’t find anything matching: Jukka
Hosp>
Hosp> LEAVE Pekka
Patient left hospital, care period closed.
Hosp> ASSIGN_STAFF Jussi Pekka
Error: Can’t find anything matching: Pekka
Hosp>
Hosp> ASSIGN_STAFF Jukka Pekka
Error: Can’t find anything matching: Jukka
Hosp>
More generally, if the first identifier (id) is not found, it is reported. If the first one is found but
the second one is not, the second one is reported. If neither is found, only the absence of the
first one is reported.
PRINT_PATIENT_INFO – This command prints information about all care periods
of the patient as well as the patient’s medication. The care periods are printed with the staL
and the start date, and for the completed care periods, the end date is also printed. The care
periods are printed in chronological order (earlier ones first). The staL and medications are
printed in alphabetical order. If there is no staL or medications, None is printed in their place.
For example:
Hosp> ENTER Pekka
A new patient has entered.
Hosp> PRINT_PATIENT_INFO Pekka
Care period: 24.2.2024 StaL: None
Medicines: None
Hosp>
Hosp> ADD_MEDICINE Burana 200 2 Pekka
Medicine added for: Pekka
Hosp> ADD_MEDICINE Panadol 500 1 Pekka
Medicine added for: Pekka
Hosp>
Hosp> RECRUIT Jussi
A new staL member has been recruited.
Hosp> RECRUIT Jukka
A new staL member has been recruited.
Hosp>
Hosp> ASSIGN_STAFF Jussi Pekka
StaL assigned for: Pekka
Hosp> ASSIGN_STAFF Jukka Pekka
StaL assigned for: Pekka
Hosp>
Hosp> PRINT_PATIENT_INFO Pekka
Care period: 24.2.2024 StaL: Jukka Jussi
Medicines:
Burana 200 mg x 2
Panadol 500 mg x 1
Hosp>
Hosp> ADVANCE_DATE 2
New date is 26.2.2024
Hosp> LEAVE Pekka
Patient left hospital, care period closed.
Hosp> ADVANCE_DATE 3
New date is 29.2.2024
Hosp>
Hosp> ENTER Pekka
A new patient has entered.
Hosp> PRINT_PATIENT_INFO Pekka
Care period: 24.2.2024 – 26.2.2024
StaL: Jukka Jussi
Care period: 29.2.2024 StaL: None
Medicines:
Burana 200 mg x 2
Panadol 500 mg x 1
Hosp>
If the given patient is not found, the program prints an error message:
Hosp> PRINT_PATIENT_INFO someone
Error: Can’t find anything matching: someone
Hosp>
The command works for all patients who have ever been in the hospital. In other words, a
patient is only not found if they have never been in the hospital.
As described in the program operation description, the medication is patient-specific, i.e., it
does not depend on the care periods. StaL members assigned to the patient, on the other
hand, are specific to the care periods.
PRINT_CARE_PERIODS – This command prints the care periods during
which the given staL member has worked or is working. The care periods are printed with the
patient and the start date, and for the completed care periods, the end date is also printed.
The care periods are printed in chronological order (earlier ones first). If the given staL
member has been recruited but has not been assigned to work on any patient’s care period
(with the ASSIGN_STAFF command), the program prints None. For example:
Hosp> RECRUIT Jussi
A new staL member has been recruited.
Hosp> PRINT_CARE_PERIODS Jussi
None
Hosp> ENTER Pekka
A new patient has entered.
Hosp> ENTER Matti
A new patient has entered.
Hosp> ASSIGN_STAFF Jussi Pekka
StaL assigned for: Pekka
Hosp> ASSIGN_STAFF Jussi Matti
StaL assigned for: Matti
Hosp> ADVANCE_DATE 2
New date is 26.2.2024
Hosp> LEAVE Matti
Patient left hospital, care period closed.
Hosp>
Hosp> PRINT_CARE_PERIODS Jussi
24.2.2024 * Patient: Pekka
24.2.2024 – 26.2.2024
* Patient: Matti
Hosp>
If the given staL member is not found, the program prints an error message:
Hosp> PRINT_CARE_PERIODS someone
Error: Can’t find anything matching: someone
Hosp>
PRINT_ALL_MEDICINES – This command prints all the currently used medications of all the
patients (also current ones) who have ever been in the hospital. The medicines are printed in
alphabetical order, and for each medicine, it’s mentioned for whom it has been prescribed.
Patients who have the same medicine are listed in alphabetical order. The medicines are
considered the same if they have the same name, regardless of the strengths or dosages. If no
medicines are in use, None is printed. For example:
Hosp> PRINT_ALL_MEDICINES
None
Hosp> ENTER Pekka
Hosp> ADD_MEDICINE Burana 200 2 Pekka
Medicine added for: Pekka
Hosp> ADD_MEDICINE Panadol 500 1 Pekka
Medicine added for: Pekka
Hosp>
Hosp> ENTER Matti
Hosp> ADD_MEDICINE Burana 400 2 Matti
Medicine added for: Matti
Hosp>
Hosp> PRINT_ALL_MEDICINES
Burana prescribed for
Matti
Pekka
Panadol prescribed for
Pekka
Hosp>
Hosp> REMOVE_MEDICINE Burana Pekka
Medicine removed from: Pekka
Hosp> PRINT_ALL_MEDICINES
Burana prescribed for
Matti
Panadol prescribed for
Pekka
Hosp>
Hosp> LEAVE Pekka
Patient left hospital, care period closed.
Hosp> PRINT_ALL_MEDICINES
Burana prescribed for
Matti
Panadol prescribed for
Pekka
Hosp>
PRINT_ALL_PATIENTS – This command prints information about all patients who have ever
been in the hospital, including current ones. The patients’ information is printed in the
alphabetical order of the patient identifier (id). If there are no patients in the hospital, None is
printed.
The command gives the same output as the PRINT_PATIENT_INFO command, but as if that
command were executed as many times as there have been patients in the hospital. Before
printing each patient’s information, the patient’s identifier (id) is printed.
Assuming that the operations of the previous command (PRINT_ALL_MEDICINES) example
run have been executed, the program prints:
Hosp> PRINT_ALL_PATIENTS
Matti
* Care period: 24.02.2024 – StaL: None
* Medicines:
– Burana 400 mg x 2
Pekka
* Care period: 24.02.2024 – 24.02.2024
– StaL: None
* Medicines:
– Panadol 500 mg x 1
Hosp>
If there had never been any patients in the hospital, the command’s output would look like
this:
Hosp> PRINT_ALL_PATIENTS
None
Hosp>
PRINT_CURRENT_PATIENTS – This command prints information about all the hospital’s
current patients. The patients’ information is printed in the alphabetical order of the patient’s
name.
The command gives the same output as the PRINT_PATIENT_INFO command, but as if that
command were executed as many times as there are currently patients in the hospital. Before
printing each patient’s information, the patient’s name is printed.
Assuming that the operations of the previous command (PRINT_ALL_MEDICINES) example
run have been executed, the program prints:
Hosp> PRINT_CURRENT_PATIENTS
Matti
* Care period: 24.02.2024 – StaL: None
* Medicines:
– Burana 400 mg x 2
Hosp>
If there were currently no patients in the hospital, the command’s output would look like this:
Hosp> PRINT_CURRENT_PATIENTS
None
Hosp>
When the program operation ends, it also prints the people whose allocated space is freed.
This can be useful when you are testing the program with your own tests. If the program has
used the people appearing in the previous examples, it prints:
Hosp> QUIT
Person Jukka destructed.
Person Jussi destructed.
Person Matti destructed.
Person Pekka destructed.
Press to close this window…
However, the automatic tests assume that such printouts do not exist, so before the Plussa
submission, remove the only code line from the destructor of the class Person.
The program modules
The codebase consists of the main program module and six other modules. The main program
module is very simple. It just starts the command line interpreter (CLI), which runs as long as
the user gives the QUIT command. The main program does not need to be changed.
The program includes the Utils module, which is not a class but a namespace. It oLers the
familiar helper function split, the function is_numeric, and the date today. You can update the
value of the date if you wish from the file utils.hh. Currently, the date is set to 24.2.2024.
Otherwise, there is no need to change this module. The date can also be changed with the
SET_DATE command.
The command interpreter, i.e., the Cli class, is defined and implemented in the files cli.hh and
cli.cpp. The class is provided in the base code, and you don’t need to make changes to it. The
class’s task is to recognize commands from the user’s inputs. All commands are
implemented in the Hospital class. The command vector in the command interpreter’s
header file contains function pointers. Based on this, you can see in which member function
of the Hospital class each command is implemented. Otherwise, it is not necessary to
understand the operation of the command interpreter. Especially, understanding/function
pointers are not required.
The Date class describes dates. Each part of the date (day, month, year) is represented as an
integer. The date can be moved forward by the number of days given as a parameter with the
advance method. The method is_default tells whether the date is the default date, i.e., a date
where the day, month, and year values are zeros. If a care period has not yet ended, its end
date is the default date. The is_default method can, therefore, be used to determine whether a
care period has ended. In addition, the Date class has methods for setting and printing the
date. Dates can be compared for equality. The class also has the < operator: date a is smaller
than date b if a precedes b. (Comparison operator functions are not currently used in the
code.) No changes need to be made to the Date class.
The Person class describes persons: patients and hospital staL. Persons are identified by the
attribute id_. In the examples above, names were used as identifiers. In this case, persons
must have unique names. In principle, a patient and a staL member could have the same
name, but then they would be interpreted as diLerent persons (diLerent objects). The Person
class also has the attribute date_of_birth_, but it may not necessarily be needed. The class's
attribute medicines_ is a map that contains the medicines prescribed to the person (patient).
Medicines cannot be added for staL because medicines can only be prescribed to patients
currently in the hospital. The Person class does not need to be changed unless you want to
add methods that you call from methods you implement in other classes. (However,
remember to remove the print line from the class's destructor, as advised at the end of the
previous section.)
The program also includes the CarePeriod class, which describes care periods. Implementing
this class is left to you.
The Hospital class describes the hospital (there could generally be several, but in this
program, there is only one). The class contains information about all the hospital's care
periods and persons, who can be patients or staL. This information is stored in containers, to
which new elements are added based on the user's commands. All commands directed at
the hospital are implemented in this class.
Note that the same patient can have multiple care periods, and the same person can work on
multiple care periods. In such cases, only one Person object is created, which is pointed to
from various places (data structures). In such situations, pointers are necessary.
The relationships between the modules (classes) are evident from the image presented at the
beginning of the assignment.
More detailed task
Your task is to complete the Hospital and CarePeriod classes so that the commands work as
described above. Other classes can be changed as needed. You might find it necessary to add
new methods to a class. Most of the data structures are given.
The CarePeriod class is almost entirely empty, and you can design and implement it
completely by yourself. The Hospital class is missing implementations for the methods:
enter
leave
assign_staL
print_patient_info
print_care_periods
print_all_medicines
print_all_patients
print_current_patients.
Each of these is intended to implement the correspondingly named missing command.
You are also allowed to implement other helper functions and add attributes.
The code (for example, printing code) should be placed in the class that processes (prints) the
data. For instance, a printing chain can originate from a "larger" class, which might itself print
something and then requests its parts to print their sections. Here, a larger class refers to a
class that has instances (or attributes) of other classes as its parts.
In completing the task, it is crucial to pay attention to how instances (objects or pointers to
them) of one class can be attributes of another class.
The program includes various types of individuals: staL, patients currently in the hospital, and
those who have been there at some point. All of these, however, are instances of the Person
class. DiLerent individuals can be diLerentiated by adding suitable boolean (bool) or
enumeration (enum) attributes to the Person class. Or, you might gather diLerent types of
individuals into separate containers (which might be a better solution). For example, the
Hospital class includes an attribute current_patients_, which contains the patients currently
in the hospital.
The parameter of many command functions (the method implementing the command) is
params, whose type is Params. This is a vector, the definition of which is in the hospital.hh file.
The number of parameters is checked in the Cli class's exec method, so in all the
implementable functions, you can assume that the params vector contains exactly as many
elements as the command requires.
Some commands do not have any parameters, hence the corresponding command functions
do not use the received params parameter. In this case, the parameter's name is omitted.
However, the type cannot be omitted because the function is called through a function
pointer. All functions called through the same type of function pointer must have the same
number of parameters of the same type. All this, however, is implemented in the base code,
so you do not need to worry about it. Completing the task does not require knowledge of
function pointers.
Hints:
Start by familiarizing yourself with the provided code. You do not need to understand the given
code thoroughly. It's okay if you don't understand the Cli class code. For other classes, it's
worthwhile to examine the methods they oLer (public methods) and what attributes they
have. Explore the details of the method implementations only if/when you need to know those
details. In most cases, it's suLicient to deduce the function's action from its name.
Before implementing the program, carefully consider how to construct the program so that
you can meet the given requirements.
The main focus in this project is on modularity and pointers. However, you will also need to
add a couple of STL containers, but choosing them should no longer pose diLiculties at this
stage.
What would be an appropriate container for the hospital's care periods when the
care periods are to be accessed in the order they were added?
What would be an appropriate container for the staL of a care period when the
staL members are to be printed in alphabetical order?
Note that the internal const functions of a class cannot call functions missing the const
qualifier. The absence of the const keyword results in a compiler [-fpermissive] error.
Therefore, a function that is forbidden from changing the object's state cannot call functions
that can modify the object's state.
Remember, by default, the program is compiled into the build directory. For testing purposes,
it's advisable to move any input files to this same directory.
Implementing the Program in Parts:
By this stage of the course, you should already have a good understanding of how to
implement programs in parts and what kind of commits to make.
Special Requirements:
To achieve an approved work, the following requirements must be adhered to:
The program must use dynamic memory management, but it must not have any memory
management-related errors. Therefore, it's advisable to run valgrind. You can use either
regular pointers or smart pointers, or both.
Only containers from the STL library are allowed, not, for example, those from the Boost
library.
Purchase answer to see full
attachment