This is a C++ question with multiple parts. Please read carefully. In this assig
ID: 654205 • Letter: T
Question
This is a C++ question with multiple parts. Please read carefully.
In this assignment, you will write a struct plus 2 simple classes and then write a program that uses all of them. The 1st class is a Date class. The 2nd is a Patient class. 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, you need to 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 (
Explanation / Answer
// Clinic.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "fstream"
#include "stdio.h"
#include "conio.h"
#include "iostream"
#include "string"
using namespace std;
struct procedure
{
int procID;
string procedurename;
int provid;
};
class Date
{
private:
string strdate;
public:
void setDate(string strday,string strmonth,string stryear)
{
strdate = strday.append("/");
strdate = strdate.append(strmonth);
strdate = strdate.append("/");
strdate = strdate.append(stryear);
}
string getDate()
{
return strdate;
}
};
class Patient
{
private:
int patientid;
string firstname;
string lastname;
Date dtbirth;
public:
void setID(int value)
{
patientid=value;
}
void setFName(string value)
{
firstname = value;
}
void setLName(string value)
{
lastname = value;
}
void setBirthDate(Date value)
{
dtbirth=value;
}
int getID()
{
return patientid;
}
string getFName()
{
return firstname;
}
string getLName()
{
return lastname;
}
Date getBirthDate()
{
return dtbirth;
}
};
void main()
{
Patient todaypt[500],allpt[1000];
char option;
ifstream infile("CurrentPatients.txt", ios::binary|ios::in);
if (infile.is_open())
{
}
infile.close();
cout << "Please enter an option :";
cin >> option;
int pcount=0;
string fname,lname;
Date dtbirth;
string day,month,year;
if(option == 'N')
{
cout << "Enter first name : ";
getline(cin,fname);
cout << "Enter last name : ";
getline(cin,lname);
cout << "Enter day of birth : ";
getline(cin,day);
cout << "Enter month of birth : ";
getline(cin,month);
cout << "Enter year of birth : ";
getline(cin,year);
dtbirth.setDate(day,month,year);
todaypt[pcount].setFName(fname);
todaypt[pcount].setLName(lname);
todaypt[pcount].setBirthDate(dtbirth);
todaypt[pcount].setID(pcount+1);
}
if(option == 'R')
{
}
if(option == 'O')
{
int pid;
cout << "Please enter the patient ID: ";
cin >> pid;
for(int i=0;i<sizeof(todaypt);i++)
{
if (todaypt[i].getID == pid)
{
}
}
}
if(option == 'I')
{
}
if(option == 'P')
{
}
if(option == 'Q')
{
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.