C++ language
Please help.
Create a small hospital system, where patients can book appointments. The program should be able to take a patient’s information and the appointment that they’d like to book. It should also be able to display the patients names in order of their appointments (ascendingly).
Your program should consist of:
Class Person: with private variables name, ID and age. A default and a copy constructor, setters and getters and a print function.
Class Patient: inherits from Person. Private variables: struct appointment : consisting of hours and mins. doctorID: to indicate the ID of the doctor assigned to their case. Overload the <,>,== operators to compare between patients’ appointments. Add any setters/getters necessary.
Class Doctor: inherits from Person. Private variables: counter: number of appointments the Doctor has for the day Array of struct (appointment): that indicates the times the Doctor is booked. A function that returns true if the Doctor is available at a certain time, false if not. Add any setters/getters necessary Template Class Queue A generic queue class to work with any data type. Main functions: Push, Pop.
Program Workflow : a) You could read multiple Doctor’s data from the user/from a file or initialize them within the main function.
b) Read multiple patients data from a file or from the user. Insert patients with their appointment into an array of patients.
c) The program should assign each patient to the doctors in the order the doctors are stored so the first patient would go to the first doctor, and the second patient to the second doctor and so on till you go back to the first doctor.
d) If a doctor is not available in the appointment the patient chose then the next doctor should be considered and so on. (Use the doctor class functions to check the doctor’s availability).
e) The patients should be inserted into a queue in order of their appointments. f) Print the information of the patients in order, along with the info of their assigned doctor.
CODE:
#include<bits/stdc++.h>
using namespace std;
struct appointment{
int hours, minutes;
};
class Person{ //Person class
private:
string name;
int id, age;
public:
Person(int id, string name, int age){ //default constructor
setName(name);
setAge(age);
setId(id);
}
Person(const Person &p){ //copy constructor
name = p.name;
id = p.id;
age = p.age;
}
void setName(string n){ //setters
name = n;
}
void setId(int i){
id = i;
}
void setAge(int a){
age = a;
}
string getName(){ //getters
return name;
}
int getId(){
return id;
}
int getAge(){
return age;
}
void print(){ //Print function
cout<<"Name: "<<name<<endl;
cout<<"ID: "<<id<<endl;
cout<<"Age: "<<age<<endl;
}
};
class Patient: public Person{ //inherited Patient class from
Person
appointment app;
int doctorId;
public:
Patient(int id, string name, int age): Person(id, name, age){
}
void setDoctorId(int id){
doctorId = id;
}
void setAppointment(appointment ap){
app.hours = ap.hours;
app.minutes = ap.minutes;
}
int getDoctorId(){
return doctorId;
}
};
class Doctor: public Person{ //inherited Doctor class from
Person
int counter=0;
appointment apps[100];
public:
Doctor(int id, string name, int age): Person(id, name, age){
}
bool isAvailable(){
if(counter<100)
return true;
else return false;
}
void setAppointments(appointment app){
apps[++counter].hours = app.hours+1;
apps[counter].minutes = app.minutes;
}
int getCounter(){
return counter;
}
appointment getAppointment(){
return apps[counter];
}
};
queue<Patient> Q; //generic queue
int main(){
Doctor d[] = {Doctor(100, "Shubham Acharya", 23), Doctor(200,
"Ankit Singh", 35)}; //doctor initialistion
Patient p[] = {Patient(1, "Anjali Sahu", 24), Patient(2, "Shweta
Sah", 22), Patient(3, "Roshan Gupta", 23)}; //Patient
initialistion
for(int i=0;i<3;i++){ //Assign doctors in round robin
fashion
if(d[i%2].isAvailable()){
p[i].setDoctorId(d[i%2].getId());
d[i%2].setAppointments(d[i%2].getAppointment());
p[i].setAppointment(d[i%2].getAppointment());
Q.push(p[i]);
}
while(!Q.empty()){ //pop queue and print info of patients
Patient p = Q.front();
Q.pop();
p.print();
cout<<"Assigned Doctor's Info: "<<endl; //print
assigned doctor's info
for (person:d){
if(p.getDoctorId() == person.getId()){
person.print();
}
}
cout<<"========================================================"<<endl;
}
}
return 0;
}
OUTPUT:

C++ language Please help. Create a small hospital system, where patients can book appointments. The program...
Task 3: Main Program Create a main program class that: Creates three or more Nurse instances assigned to different shifts. Creates three or more Doctor instances. Creates three or more Patient instances with pre-determined names and manually assigned physicians chosen from the pool of Doctor instances previously created. Generates another 20 Patient instances using randomly generated names and randomly assigns them physicians chosen from the pool of Doctor instances previously created. Prints the toString() values for all employees. Prints the...
PLEASE ANSWER IN C#
5. a. Create a Patient class for the Wrightstown Hospital Billing Department. Include auto-implemented prop- erties for a patient ID number, name, age, and amount due to the hospital, and include any other methods you need. Override the ToString method to return all the details for a patient. Write an application that prompts the user for data for five Patients. Sort them in patient ID number order and display them all, including a total amount owed....
CÖ) Could you please help me to solve this problem?(ONLY USING C++ PROGRAMMING LANGUAGE PLEASE) Write a program for the patient information system in a policlinic. The patients are examined according to the triage char assigned to them. Triage codes are as follows: - ‘h’ : high priority - ‘m’ : medium priority - ‘l’ : low priority The patients having ‘h’ triage char are examined first then the patients having ‘m’ comes and finally patients with ‘l’ triage code...
C++ LAB 19 Construct functionality to create a simple ToDolist. Conceptually the ToDo list uses a structure called MyToDo to hold information about each todo item. The members of the MyToDo struct are description, due date, and priority. Each of these items will be stored in an array called ToDoList. The definition for the MyToDo struct should be placed in the header file called ToDo.h Visually think of the ToDoList like this: There are two ways to add items to...
please need help with the java program A micro car rental company. package yourLastName.cis4110.assignment5; Please create an enum type, say Cartype, featuring all rental car types -- SUBCOMPACT, COMPACT, MIDSIZE, FULLSIZE (You may put the enum definition in Car class) class Car Instance variables: - private String plateNum - private Cartype carType - private boolean availability Member methods: - Please define all setters and getters class RentACar - This is a five car system for prototyping instance variables:...
Help with C++ please Create a class called ClassQuiz. ClassQuiz will maintain quiz grades for students in a class. The class has the following member variables: int numStudents // holds the number of students in the class double* grades // to point to a dynamically allocated array of grades The class has the following public functions: +default constructors //set numStudents = 0; and grades = nullptr; +parameterized constructors //accepts numStudents and creates an array with size = numStudents; +AcceptGrades //...
c++ only Design a class representing an Employee. The employee would have at least these private fields (Variables): name: string (char array) ID: string (char array) salary: float Type: string (char array) All the variables except for the salary should have their respective setters and getters, and the class should have two constructors, one is the default constructor and the other constructor initializes the name,ID and type of employee with valid user input. The class should have the following additional...
C++ program
Write a C++ program to manage a hospital system, the system mainly uses file handling to perform basic operations like how to add, edit, search, and delete record. Write the following functions: 1. hospital_menu: This function will display the following menu and prompt the user to enter her/his option. The system will keep showing the menu repeatedly until the user selects option 'e' from the menu. Arkansas Children Hospital a. Add new patient record b. Search record c....
C++ program, item.cpp implementation.
Implementation: You are supposed to write three classes, called Item, Node and Inventory respectively Item is a plain data class with item id, name, price and quantity information accompanied by getters and setters Node is a plain linked list node class with Item pointer and next pointer (with getters/setters) Inventory is an inventory database class that provides basic linked list operations, delete load from file / formatted print functionalities. The majority of implementation will be done...
About Classes and OOP in C++ Part 1 Task 1: Create a class called Person, which has private data members for name, age, gender, and height. You MUST use this pointer when any of the member functions are using the member variables. Implement a constructor that initializes the strings with an empty string, characters with a null character and the numbers with zero. Create getters and setters for each member variable. Ensure that you identify correctly which member functions should...