You are working in a doctors' office and have been tasked with creating an application to maintain Patient records for each doctor in the office. Create a class to maintain a Doctor. A doctor has a name that must be stored in the Doctor class. A doctor can only treat 3 patients but could treat fewer than 3. The information for each patient should be encapsulated in a Patient class and should include the patient's last name and up to 5 cholesterol readings for the patient. Note that less than 5 cholesterol readings may sometimes be stored. Your Doctor class should support operations to add a patient record to the end of his/her list of assigned patients (i.e., use a vector to store Patient objects in the Doctor class), and to list all patient records (name and associated cholesterol readings). Your Patient class should include operations to allow entry of the patient's last name and up to 5 cholesterol readings, and to return the name and cholesterol readings for that patient. You should write a main program that creates a single Doctor and presents a menu to users that allows them to select either Add (A), or List (L), or Quit (Q). Add should allow the user to enter a patient record (name and cholesterol readings) and add it to the end of the doctor's list of patients. List should list all patient records currently in the doctor's list. Remember that a patient record includes the patient's name as well as his/her cholesterol readings. You should be able to add and list repeatedly, until you select Q to quit. Use good coding style and principles for all code and input/output formatting. All data in a class must be private. Put each class declaration in its own header file and its implementation in a separate .cpp file. How to approach this lab: 1. In main(): a. Prompt the user to enter a name for a doctor. b. Create an object of the Doctor class, passing in the name of the doctor as an argument to the constructor of the Doctor class. c. Create a menu with “cout" statements. d. Create a switch statement that contains the cases that the user could enter. e. For the Add patients case, prompt the user to enter a name for the patient if the number of patients already existing is less than 3. 1. Using the Doctor object, call the function in the Doctor class to add a patient, passing in the name of the patient that the user entered. f. For the List Patients case, call the function that prints patient records, again by using the Doctor object to call the function in the Doctor class.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter14: Files And Streams
Section: Chapter Questions
Problem 4E
icon
Related questions
Question
100%

Can you please help me write this in C++ with this implemented with in it

 

Excutes without crashing

Appropriate Internal Documentation

Doctor class created

     Doctor.h

     Doctor.cpp

     Contains data for no more than 3 patients

Patient class created

     Patient.h

     Patient.cpp

     Contains data for up to 5 cholesterol readings

Menu

     Add:  Successfully adds a patient record

                 Successfully adds cholesterol readings

     List:  Lists all the data

     Quit:  Quits

     Loops until the user selects quit

Style:

     Data members are correctly declared

     Member functions exist in the correct classes

     Overall style is appropriate (no globals unless constants, modularity, uses a
     vector, adheres to the principle of least privilege, etc.)

Appropriate formatting of output

Requirements:
You are working in a doctors' office and have been tasked with creating an application to
maintain Patient records for each doctor in the office.
Create a class to maintain a Doctor. A doctor has a name that must be stored in the Doctor class.
A doctor can only treat 3 patients but could treat fewer than 3. The information for each patient
should be encapsulated in a Patient class and should include the patient's last name and up to 5
cholesterol readings for the patient. Note that less than 5 cholesterol readings may sometimes be
stored. Your Doctor class should support operations to add a patient record to the end of his/her
list of assigned patients (i.e., use a vector to store Patient objects in the Doctor class), and to list
all patient records (name and associated cholesterol readings). Your Patient class should include
operations to allow entry of the patient's last name and up to 5 cholesterol readings, and to return
the name and cholesterol readings for that patient.
You should write a main program that creates a single Doctor and presents a menu to users that
allows them to select either Add (A), or List (L), or Quit (Q). Add should allow the user to enter
a patient record (name and cholesterol readings) and add it to the end of the doctor's list of
patients. List should list all patient records currently in the doctor's list. Remember that a patient
record includes the patient's name as well as his/her cholesterol readings. You should be able to
add and list repeatedly, until you select Q to quit.
Use good coding style and principles for all code and input/output formatting. All data in a class
must be private. Put each class declaration in its own header file and its implementation in a
separate .cpp file.
How to approach this lab:
1. In main():
a. Prompt the user to enter a name for a doctor.
b. Create an object of the Doctor class, passing in the name of the doctor as an
argument to the constructor of the Doctor class.
c. Create a menu with "cout" statements.
d. Create a switch statement that contains the cases that the user could enter.
e. For the Add patients case, prompt the user to enter a name for the patient if the
number of patients already existing is less than 3.
1. Using the Doctor object, call the function in the Doctor class to add a
patient, passing in the name of the patient that the user entered.
f. For the List Patients case, call the function that prints patient records, again by
using the Doctor object to call the function in the Doctor class.
Transcribed Image Text:Requirements: You are working in a doctors' office and have been tasked with creating an application to maintain Patient records for each doctor in the office. Create a class to maintain a Doctor. A doctor has a name that must be stored in the Doctor class. A doctor can only treat 3 patients but could treat fewer than 3. The information for each patient should be encapsulated in a Patient class and should include the patient's last name and up to 5 cholesterol readings for the patient. Note that less than 5 cholesterol readings may sometimes be stored. Your Doctor class should support operations to add a patient record to the end of his/her list of assigned patients (i.e., use a vector to store Patient objects in the Doctor class), and to list all patient records (name and associated cholesterol readings). Your Patient class should include operations to allow entry of the patient's last name and up to 5 cholesterol readings, and to return the name and cholesterol readings for that patient. You should write a main program that creates a single Doctor and presents a menu to users that allows them to select either Add (A), or List (L), or Quit (Q). Add should allow the user to enter a patient record (name and cholesterol readings) and add it to the end of the doctor's list of patients. List should list all patient records currently in the doctor's list. Remember that a patient record includes the patient's name as well as his/her cholesterol readings. You should be able to add and list repeatedly, until you select Q to quit. Use good coding style and principles for all code and input/output formatting. All data in a class must be private. Put each class declaration in its own header file and its implementation in a separate .cpp file. How to approach this lab: 1. In main(): a. Prompt the user to enter a name for a doctor. b. Create an object of the Doctor class, passing in the name of the doctor as an argument to the constructor of the Doctor class. c. Create a menu with "cout" statements. d. Create a switch statement that contains the cases that the user could enter. e. For the Add patients case, prompt the user to enter a name for the patient if the number of patients already existing is less than 3. 1. Using the Doctor object, call the function in the Doctor class to add a patient, passing in the name of the patient that the user entered. f. For the List Patients case, call the function that prints patient records, again by using the Doctor object to call the function in the Doctor class.
2. In the Doctor class:
a. Make sure you have a constructor that initializes the Doctor name. Remember that
the name is passed in from main().
b. The Doctor class contains the function to add a Patient. In it, you will create a
new Patient object (passing in the name of the patient that came from main(), and
add it to the vector of Patient objects (which is a data member in the Doctor
class).
c. As soon as you create a Patient object in the Doctor class, call the function in the
Patient class that allows the user to enter up to 5 cholesterol readings for that
patient. Next, add that completed patient record to the vector of Patient records in
the Doctor class.
d. Include a function that will print each Patient object in the Doctor class. That is,
loop over all the Patient objects in the vector and for each object, call a function
in the Patient class that will print each patient's record. It's like using Doctor as a
middleman... main() calls a function in the Doctor class to list the patients'
assigned to that doctor. Doctor contains the loop to iterate over each Patient
object in its vector, then within the loop, each Patient object calls a function in the
Patient class that will print out the names and cholesterol readings of a given
Patient object.
3. In the Patient class:
a. Make a constructor that initializes the patient's name to whatever was entered in
main() and subsequently passed in to your Doctor function that adds new
patients. Recall that this information will be passed in to the Patient constructor
from the Add Patient function in Doctor.
b. Create a function that will allow the user to enter up to 5 cholesterol readings for a
patient. This function will actually contain the cout and cin commands to prompt
the user to enter each cholesterol reading. (Don't worry about putting error checks
in here because I won't try to break it.)
c. Naturally, this class will contain either an array or vector (your choice) of
cholesterol readings that the user will enter (no more than 5 but could be fewer).
d. The Patient class will contain a function that displays the cholesterol readings for
a patient. It will need to loop over all the cholesterol readings in the array for the
patient and print them out. This function will be called from the function in the
Doctor class that prints out each Patient object.
Transcribed Image Text:2. In the Doctor class: a. Make sure you have a constructor that initializes the Doctor name. Remember that the name is passed in from main(). b. The Doctor class contains the function to add a Patient. In it, you will create a new Patient object (passing in the name of the patient that came from main(), and add it to the vector of Patient objects (which is a data member in the Doctor class). c. As soon as you create a Patient object in the Doctor class, call the function in the Patient class that allows the user to enter up to 5 cholesterol readings for that patient. Next, add that completed patient record to the vector of Patient records in the Doctor class. d. Include a function that will print each Patient object in the Doctor class. That is, loop over all the Patient objects in the vector and for each object, call a function in the Patient class that will print each patient's record. It's like using Doctor as a middleman... main() calls a function in the Doctor class to list the patients' assigned to that doctor. Doctor contains the loop to iterate over each Patient object in its vector, then within the loop, each Patient object calls a function in the Patient class that will print out the names and cholesterol readings of a given Patient object. 3. In the Patient class: a. Make a constructor that initializes the patient's name to whatever was entered in main() and subsequently passed in to your Doctor function that adds new patients. Recall that this information will be passed in to the Patient constructor from the Add Patient function in Doctor. b. Create a function that will allow the user to enter up to 5 cholesterol readings for a patient. This function will actually contain the cout and cin commands to prompt the user to enter each cholesterol reading. (Don't worry about putting error checks in here because I won't try to break it.) c. Naturally, this class will contain either an array or vector (your choice) of cholesterol readings that the user will enter (no more than 5 but could be fewer). d. The Patient class will contain a function that displays the cholesterol readings for a patient. It will need to loop over all the cholesterol readings in the array for the patient and print them out. This function will be called from the function in the Doctor class that prints out each Patient object.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random access
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage