In: Computer Science
Using C++
In a separate header file:
Create a new type called "Patient" - you must use
a class.
Give your "Patient" type at least five (5) member elements of your
choosing, and at least one member function.
You should have member elements to hold patient name, and
visitReason (which can change), and other items of your
choosing.
In your cpp file:
Create at least one instance of Patient type (example:
CurrentPatient ).
Create a menu-driven program OF YOUR OWN DESIGN that runs record
keeping for the dentist office.
(Example: add new patient record, show patient records, update
patient records etc.)
Include File I/O options for saving and recalling patient
records.
#include<iostream>
#include<string>
using namespace std;
/*Paitent class with more than five member elements*/
class Paitent
{
private:
string name;
float weight;
int height;
string visitReason;
public:
void setName(string n)
{
name = n;
}
string getName()
{
return(name);
}
void setWeight(float w)
{
weight =
w;
}
float getWeight()
{
return
weight;
}
void setHeight(int h)
{
height =
h;
}
int getHeight()
{
return
height;
}
void setReason(string v)
{
visitReason =
v;
}
string getReason()
{
return
visitReason;
}
};
int main()
{
int choice;
float weight;
int height;
string visitReason;
string name;
Paitent p;
/*Menu driven progarm for create, update and display the paitent details*/
do
{
cout << "\n1.Create a new
paitent record.";
cout << "\n2.Update paitent
record.";
cout << "\n3.display the
paitent record.\n\n";
cout << "Enter your choice:
\n";
cin >> choice;
switch(choice)
{
case 1:
cout <<"\nEnter the name of the Paitent:
";
cin >> name;
p.setName(name);
cout <<"\nEnter the height of the Paitent:
";
cin >> height;
p.setHeight(height);
cout <<"\nEnter the weight of the Paitent:
";
cin >> weight;
p.setWeight(weight);
cout <<"\nEnter the reason of visit:
";
cin >> visitReason;
p.setReason(visitReason);
break;
case 2:
cout <<"\nUpdate the name of the Paitent:
";
cin >> name;
p.setName(name);
cout <<"\nupdate the height of the
Paitent: ";
cin >> height;
p.setHeight(height);
cout <<"\nupdate the weight of the
Paitent: ";
cin >> weight;
p.setWeight(weight);
cout <<"\nupdate the reason of visit:
";
cin >> visitReason;
p.setReason(visitReason);
break;
case 3:
cout <<"\nName of the Paitent:
"<<p.getName();
cout <<"\nHeight:
"<<p.getHeight();
cout <<"\nWeight:
"<<p.getWeight();
cout <<"\nReason:
"<<p.getReason();
break;
case 0:
cout <<"\nThe end.";
break;
default:
cout <<"\nInvalid choice.";
}
}while(choice!=0);
return 0;
}
Output: