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)
Create a C++ login program using file for 2 user. Usernames must be in one file...
Create a C++ login program using file for 2 user. Usernames must be in one file and password in the other file. Ask user for their usernames and password if it matches, they logged in successfully. If it doesn’t match,they have 3 trials ,then they have to sign in and create a username and password. After creating a username and password, they have to go to the login page again. Must work for visual studio code
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...
Start NetBeans. Create a new project called Lab7. Create a Java main class file using the...
Start NetBeans. Create a new project called Lab7. Create a Java main class file using the class name YourlastnameLab7 with your actual last name. Create a Java class file for a Polygon class. Implement the Polygon class. Add a private instance variable representing the number of sides in the polygon. Add a constructor that takes a single argument and uses it to initialize the number of sides. If the value of the argument is less than three, display an error...
Given the header file (grid.h) and the source file,(grid.cpp) create the file trap.cpp. Here are the...
Given the header file (grid.h) and the source file,(grid.cpp) create the file trap.cpp. Here are the requirements for trap.cpp: Write a main program in a file called trap.cpp that solves the following scenario, using your Grid class: Giant Mole People have risen from their underground lairs and are taking over the world. You have been taken prisoner and placed in an underground jail cell. Since the Mole People are blind and don't know how to build doors, your cell has...
In C++ Create a class called Rational (separate the files as shown in the chapter) for...
In C++ Create a class called Rational (separate the files as shown in the chapter) for performing arithmetic with fractions. Write a program to test your class. Use integer variables to represent the private data of the class-the numerator and the denominator. Provide a constructor that enables an object of this class to be initialized when it's declared. The constructor should contain default values in case no initializers are provided and should store the fraction in reduced form. For example,...
use c++ Provide a header file as well. So for this question provide Rational.h, Rantional.cpp Create...
use c++ Provide a header file as well. So for this question provide Rational.h, Rantional.cpp Create a class called Rantional for performing arithmatic with fractions. Then write a program to test your class. Use integer variables to represent the private data of the class, meaning the numerator and the denominator. Provide a constructor that enables an object of this class to be initialized when it's declared. The constructor should contain default values in case no initializers are provided and should...
Working with Files in C++. Create the following  program called payroll.cpp.  Note that the file you...
Working with Files in C++. Create the following  program called payroll.cpp.  Note that the file you read must be created before you run this program.  The output file will be created automatically by the program.  You can save the input file in the same directory as your payroll.cpp file by using Add New Item, Text File.   // File:  Payroll.cpp // Purpose:  Read data from a file and write out a payroll // Programmer:  (your name and section) #include <cstdlib>...
Create this C++ program using classes 1. Create a file text file with a string on...
Create this C++ program using classes 1. Create a file text file with a string on it 2. Check the frecuency of every letter, number and symbol (including caps) 3. Use heapsort to sort the frecuencys found 4. Use huffman code on the letters, symbols or numbers that have frecuencys I created the file, and the frecuency part but i'm having trouble with the huffman and heapsort implementation.
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT