Question: I need help with c++ Simple Classes Assigment. i get this code working but i have to
change my setID from numbers in loop{1,2,3,4,5} to setID to *char which it have to start with
lastName, then lastName, then year of birth.
c++ Simple Classes Assignment
In this assignment, you will write a struct plus two simple classes and then write a program
that uses them all. The first class is a Date class. You are given code for this at the end of this
assignment, but you must make some modifications. The other is a Patient class; you are given
the class definition and you must write the implementation. The program will keep track of
patients at a walk-in clinic. For each patient, the clinic keeps a record of all procedures done.
This is a good candidate for a class, but to simplify the assignment, we will make a procedure
into a struct. We will assume that the clinic has assigned all care providers (doctors, nurses, lab
technicians) with IDs and each procedure (“office visit”, “physical exam”, “blood sample taken”,
etc.) also has an ID. Each patient will also have an ID, which is formed by the last name
concatenated with the first name and the year of birth. All other IDs (care providers, procedures)
will be just integers.
When the user runs the program at the start of the day, it first tries to read in from a binary file
called CurrentPatients.dat. It will contain the number of patients(in binary format) followed by
binary copies of records for the patients at the clinic . This information should be read and stored
in an array of Patient objects. There will be a separate array, initially empty at the start of the
program that will store patient records for all patients who are currently checked in at the clinic.
It then asks the user to enter the current date and reads it in. It should then presents the user with
a simple menu: the letter N to check in a new patient, R for checking in a returning patient, O to
check out a patient, I to print out information on a particular patient, P to print the list of patients
who have checked in, but not yet checked out, and Q for quitting the program.
The following tasks are done when the appropriate letter is chosen.
N: The new patient’s first name, last name, and birthdate are asked for and entered. The new
patient ID will be the last name concatenated with the first name and the year of birth. (Example:
SmithJohn1998) The primary doctor’s ID is also entered. The new patient object is placed in
both arrays: one keeping all patients, and one keeping the patients who checked in today.
R: The returning patient’s ID is asked for, and the array holding all patients is searched for the
patient object. If found, a copy of the patient object is placed in the array for all currently
checked in patients. If not found, the user is returned to the main menu after asking them to
either try R again, making sure the correct ID was entered, or choose N to enter the patient as a
new patient.
O: Using the patient’s ID.
Question I need help with c++ Simple Classes Assigment. i get this .pdf
1. Question: I need help with c++ Simple Classes Assigment. i get this code working but i have to
change my setID from numbers in loop{1,2,3,4,5} to setID to *char which it have to start with
lastName, then lastName, then year of birth.
c++ Simple Classes Assignment
In this assignment, you will write a struct plus two simple classes and then write a program
that uses them all. The first class is a Date class. You are given code for this at the end of this
assignment, but you must make some modifications. The other is a Patient class; you are given
the class definition and you must write the implementation. The program will keep track of
patients at a walk-in clinic. For each patient, the clinic keeps a record of all procedures done.
This is a good candidate for a class, but to simplify the assignment, we will make a procedure
into a struct. We will assume that the clinic has assigned all care providers (doctors, nurses, lab
technicians) with IDs and each procedure (“office visit”, “physical exam”, “blood sample taken”,
etc.) also has an ID. Each patient will also have an ID, which is formed by the last name
concatenated with the first name and the year of birth. All other IDs (care providers, procedures)
will be just integers.
When the user runs the program at the start of the day, it first tries to read in from a binary file
called CurrentPatients.dat. It will contain the number of patients(in binary format) followed by
binary copies of records for the patients at the clinic . This information should be read and stored
in an array of Patient objects. There will be a separate array, initially empty at the start of the
program that will store patient records for all patients who are currently checked in at the clinic.
It then asks the user to enter the current date and reads it in. It should then presents the user with
a simple menu: the letter N to check in a new patient, R for checking in a returning patient, O to
check out a patient, I to print out information on a particular patient, P to print the list of patients
who have checked in, but not yet checked out, and Q for quitting the program.
The following tasks are done when the appropriate letter is chosen.
N: The new patient’s first name, last name, and birthdate are asked for and entered. The new
patient ID will be the last name concatenated with the first name and the year of birth. (Example:
SmithJohn1998) The primary doctor’s ID is also entered. The new patient object is placed in
both arrays: one keeping all patients, and one keeping the patients who checked in today.
R: The returning patient’s ID is asked for, and the array holding all patients is searched for the
patient object. If found, a copy of the patient object is placed in the array for all currently
checked in patients. If not found, the user is returned to the main menu after asking them to
either try R again, making sure the correct ID was entered, or choose N to enter the patient as a
new patient.
O: Using the patient’s ID, the patient object is found in the array holding currently checked in
2. patients. (If not found, the user is returned to the main menu after asking them to either try O
again, making sure the correct ID was entered, or choose N or R to check in the patient as a new
or returing patient.) The procedure record is updated by entering a new entry, with the current
date, procedure ID, and provider ID. The up-dated patient object is then removed from the array
of currently checked in patients, and replaces the old patient object in the main array. If the
update fails, a message is output.
I: Using the patient’s ID, the main array holding all patients is searched for the patient object. If
found the information it holds: the names, birthdate, the primary doctor ID, and a list of all past
procedures done (date, procedure ID, procedure provider ID) is printed to the monitor.
P: From the array holding all patients currently checked in, a list is printed in nice readable form,
showing the patient ID, first and last names, and the primary doctor ID for each patient.
Q: If the list of patients currently checked in is not empty, the list is printed out and the user
asked to keep running the program so they can be checked out. If the list is empty, the program
will write the patient objects in the main array to the binary file CurrentPatients.dat. It should
overwrite all previous information in the file.
//Date1.h
#ifndef Date_h
#define Date_h
#include
#include
using namespace std;
class Date1
{
friend ostream &operator<<(ostream& , const Date1 &);
public:
Date1(int m1 = 1, int d1 = 1, int y1 = 1900);
void setDate1(int, int, int);
bool leapYear1() const;
bool endOfMonth1() const;
int getMonth1() const
{
return month1;
}
int getDay1() const
{
return day1;