Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming Assignment 1 Hospital Billing System Purpose This assignment is desi

ID: 440284 • Letter: P

Question

Programming Assignment 1 Hospital Billing System Purpose This assignment is designed to assist students in becoming familiar with topics they will use in doing programming assignments in Data Structures. Problem Statement In this exercise, you will design various classes and write a programto computerize the billing system of a hospital. Design the class doctorType, inherited from the class personType with an additional data member to store a doctor's speciality. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Design the class billType with data members to store a patient's ID and a patient's hospital charges, such as pharmacy charges for medicine, doctor's fees, and room charges. Add appropriate constructors and member function to initialize and access and manipulate the data members. Deign the class patientType, inherited from the class personType, defined in Chapter 11, with additional data members to store a patient's ID, age, date of birth, attending physician's name, the date when the patient was discharged from the hospital. (Use the class dateType to store the date of birth, admit date, discharge date, and the class doctorType to store the attending physician's name.) Add appropriate constructors and member functions to initialize, access and manipulate the data members. Write a program to test your classes. What to turn in Programming assignments should have a title page which includes program number, name, and section number. There should also be a hardships and challenges paper written to tell all problems which were encountered and solutions to those problems. A copy of the source code should also be submitted. All files should be named accordingly (i.e Timothy Holston CS 205 program1 would be tholston_cs205_progl.cpp). Send all material to tholston@bluebird.mvsu.edu with CS205 and assignment/program number in the subject line of the email by the deadline specified by the instructor. If there are any questions, email thost@mvsu.edu for answers/help.

Explanation / Answer

#include #include #include #include // define maximum number of patients in a queue #define MAXPATIENTS 100 // define structure for patient data struct patient { char FirstName[50]; char LastName[50]; char ID[20]; }; // define class for queue class queue { public: queue (void); int AddPatientAtEnd (patient p); int AddPatientAtBeginning (patient p); patient GetNextPatient (void); int RemoveDeadPatient (patient * p); void OutputList (void); char DepartmentName[50]; private: int NumberOfPatients; patient List[MAXPATIENTS]; }; // declare member functions for queue queue::queue () { // constructor NumberOfPatients = 0; } int queue::AddPatientAtEnd (patient p) { // adds a normal patient to the end of the queue. // returns 1 if successful, 0 if queue is full. if (NumberOfPatients >= MAXPATIENTS) { // queue is full return 0; } // put in new patient else List[NumberOfPatients] = p; NumberOfPatients++; return 1; } int queue::AddPatientAtBeginning (patient p) { // adds a critically ill patient to the beginning of the queue. // returns 1 if successful, 0 if queue is full. int i; if (NumberOfPatients >= MAXPATIENTS) { // queue is full return 0; } // move all patients one position back in queue for (i = NumberOfPatients-1; i >= 0; i--) { List[i+1] = List[i]; } // put in new patient List[0] = p; NumberOfPatients++; return 1; } patient queue::GetNextPatient (void) { // gets the patient that is first in the queue. // returns patient with no ID if queue is empty int i; patient p; if (NumberOfPatients == 0) { // queue is empty strcpy(p.ID,""); return p;} // get first patient p = List[0]; // move all remaining patients one position forward in queue NumberOfPatients--; for (i=0; i