Concept explainers
C++ Help
Patients
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
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:
- In main():
- Prompt the user to enter a name for a doctor.
- Create an object of the Doctor class, passing in the name of the doctor as an argument to the constructor of the Doctor class.
- Create a menu with “cout” statements.
- Create a switch statement that contains the cases that the user could enter.
- 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.
- 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.
- 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.
- In the Doctor class:
- Make sure you have a constructor that initializes the Doctor name. Remember that the name is passed in from main().
- 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).
- 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.
- 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.
- In the Patient class:
- 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.
- 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.)
- 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).
- 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.
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 5 images
- Create etBeans project with the following configuration: Project Name: Assignment_3_6_1 Package: makechange • Class Name: MakeChange Write a program that calculates the number of coins necessary to make change for any amount the user types in. The program should have variables for the amount of: • toonies • loonies quarters • dimes nickels pennies (even though they don't exist any more) Display all of the information clearly in tl.e output of the program. HINT: Use integer division (/) and modulus (8) in your calculations. Your tion could look similar to:arrow_forward1- A variable of class type (i.e., object) always require the same amount of memory to store its values? False True 2- A class that contains no methods (other than constructors) that change any of the data in its object is called as: Mutable class Immutable class Anonymous class Class invariantarrow_forwardInstructions The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. An example of the program is shown below: Enter a radius for a circle >> 7 The radius is 7 The diameter is 14 The area is 153.93791 Task 1: The DebugPen class compiles without error. This task is dependent on completing task #2. Task 2: The DebugCircle class methods work without errors. Task 3: The DebugFour1 class compiles without error. Task 4: The DebugFour1 program accepts user input and displays the correct output.arrow_forward
- An object’s attributes indicate the tasks that the object can perform. True or False?arrow_forwardC# When the program is running, it can use the class to create as many objects of a specific type as needed. Each object that is created from a class is called a(n) __ of the class. Question 1 options: event instance namespace memberarrow_forwardc++ ooparrow_forward
- More data is always better than less data when making a programming choice, but you shouldn't make a call based only on performance.arrow_forwardIn order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCult ureInfo method. In order to do this, include the statement using System.Globalizatio n; at the top of your program and format the output statements as follows: Writeline ("This is an example: {0}", value. ToString("C", CultureInfo.GetCult ureInfo("en-US")));arrow_forward________ are the number of different ways in which objects can be arranged without regard to order. Simple events Random variables Combinations Permutationsarrow_forward
- Pls help ASAParrow_forwardstd::shared_ptr is a class that implements the concept of _____. Select one: a. shared ownership of the pointer it contains b. exclusive ownership of the pointer it contains c. no ownership of the pointer it contains d. partial ownership of the pointer it containsarrow_forwardC++ Visual Studio 2019 NumDays, TimeOff, and Personnel Report Complete #4, 5 & 6 . Please submit just one file for the classes and main to test the classes. Just create the classes before main and submit only one cpp file. Do not create separate header files. See below code for NumDays class for you to use as a base. #include <iostream> using namespace std; class NumDays{private: double hours; double days;public: NumDays(double h = 0) { hours = h; days = h / 8; } void setHours(double h) { hours = h; days = h / 8; } void setDays(double d) { days = d; hours = d *8; } double getHours()const { return hours; } double getDays()const { return days; } //overloaded + operator NumDays operator+(NumDays& right) { NumDays temp; temp.setHours(hours + right.getHours()); return temp; } //overloaded - operator NumDays operator -(NumDays&…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education