Question

In: Computer Science

Using C++ In a separate header file: Create a new type called "Patient" - you must...

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.

Solutions

Expert Solution


#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:



Related Solutions

Using C++ Create the UML, the header, the cpp, and the test file for an ArtWork...
Using C++ Create the UML, the header, the cpp, and the test file for an ArtWork class. The features of an ArtWork are: Artist name (e.g. Vincent vanGogh or Stan Getz) Medium (e.g. oil painting or music composition) Name of piece (e.g. Starry Night or Late night blues) Year (e.g. 1837 or 1958)
You are to write a class named Rectangle. You must use separate files for the header...
You are to write a class named Rectangle. You must use separate files for the header (Rectangle.h) and implementation (Rectangle.cpp) just like you did for the Distance class lab and Deck/Card program. You have been provided the declaration for a class named Point. Assume this class has been implemented. You are just using this class, NOT implementing it. We have also provided a main function that will use the Point and Rectangle classes along with the output of this main...
using the header: #include <pthread.h> // This is a header file for a Read/Right Lock Library....
using the header: #include <pthread.h> // This is a header file for a Read/Right Lock Library. Your C code //SHOULD access your routines using these exact function // prototypes typedef struct RW_lock_s { } RW_lock_t; void RW_lock_init(RW_lock_t *lock); /* This routine should be called on a pointer to a struct variable of RW_lock_t to initialize it and ready it for use. */ void RW_read_lock(RW_lock_t *lock); /* This routine should be called at the beginning of a READER critical section */...
Create a class Student (in the separate c# file but in the project’s source files folder)...
Create a class Student (in the separate c# file but in the project’s source files folder) with those attributes (i.e. instance variables): Student Attribute Data type (student) id String firstName String lastName String courses Array of Course objects Student class must have 2 constructors: one default (without parameters), another with 4 parameters (for setting the instance variables listed in the above table) In addition Student class must have setter and getter methods for the 4 instance variables, and getGPA method...
Using JavaScript You must submit a file called, called pass.js pass.js: Validator of passwords Your task...
Using JavaScript You must submit a file called, called pass.js pass.js: Validator of passwords Your task this week will be to program a valid password validator. A password is safe only if it satisfies the following constraints: - It has from 5 to 10 characters (inclusive) - It contains at least one lowercase letter, at least one capital letter and at least one number - The first character is different from the last Once the password is entered and validated,...
Using Python create a script called create_notes_drs.py. In the file, define and call a function called...
Using Python create a script called create_notes_drs.py. In the file, define and call a function called main that does the following: Creates a directory called CyberSecurity-Notes in the current working directory Within the CyberSecurity-Notes directory, creates 24 sub-directories (sub-folders), called Week 1, Week 2, Week 3, and so on until up through Week 24 Within each week directory, create 3 sub-directories, called Day 1, Day 2, and Day 3 Bonus Challenge: Add a conditional statement to abort the script if...
C++ Programming Simply explain what the difference between "including" a header file and using a compiled...
C++ Programming Simply explain what the difference between "including" a header file and using a compiled library file during linking? Where are the C++ header files and compiled C++ library files on your computer?
The requirements for this program are as follows: Create a header file named “Employee.h”. Inside this...
The requirements for this program are as follows: Create a header file named “Employee.h”. Inside this header file, declare an Employee class with the following features: Private members a std::string for the employee’s first name a std::string for the employee’s last name an unsigned int for the employee’s identification number a std::string for the city in which the employee works Public members A constructor that takes no arguments A constructor that takes two arguments, representing: the employee’s first name the...
A header file contains a class template, and in that class there is a C++ string...
A header file contains a class template, and in that class there is a C++ string object. Group of answer choices(Pick one) 1)There should be a #include for the string library AND a using namespace std; in the header file. 2)There should be a #include for the string library. 3)There should be a #include for the string library AND a using namespace std; in the main program's CPP file, written before the H file's include.
Complete the following task in C++. Separate your class into header and cpp files. You can...
Complete the following task in C++. Separate your class into header and cpp files. You can only useiostream, string and sstream. Create a main.cpp file to test your code thoroughly. Given : commodity.h and commodity.cpp here -> https://www.chegg.com/homework-help/questions-and-answers/31-commodity-request-presented-two-diagrams-depicting-commodity-request-classes-form-basic-q39578118?trackid=uF_YZqoK Create : locomotive.h, locomotive.cpp, main.cpp Locomotive Class Hierarchy Presented here will be a class diagram depicting the nature of the class hierarchy formed between a parent locomotive class and its children, the two kinds of specic trains operated. The relationship is a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT