Question
C++ Help Please!!!! I need to get a better understanding of this exercise. //The code I have #include #include #include #include int days[13]={0, 31, 28,
C++ Help Please!!!!
I need to get a better understanding of this exercise.
//The code I have
#include
using namespace std; class Date{ private: int month; int day; int year; public:
/* Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400. */ bool isLeapYear(int y){ if (y % 4 != 0) { cout << "Common year" << endl; return false; }
else if (y % 100 != 0) { cout << "Leap year" << endl; return true; }
else if (y % 400 != 0) { cout << "Common year" << endl; return false; } else { cout << "Leap year" << endl; return true; } } /* verify if the ranges of month/m, day/d, year/y are correct. month should be 1-12 day should be based on its month and whether it is leap year. (Feb has 29 days for a leap year) year should be between 2000-2020 return false if in invalid range. otherwise return true. the upper bound of day/d of each month is given in the array days at line 21 */ bool checkRange(int m, int d, int y){ //add source code here... } //constructor of Date class Date(int m=1, int d=1, int y=2000) { /*call checkRange and see if m, d, y are within the range or not. if not, continue to request input from user until the ranges are valid. Assign m, d, y to month, day, year, respectively after validation. */ //add source code here... } int getMonth() { return month; } int getDay() { return day; } int getYear() { return year; } }; class Patient { private: string name; string ID; int age; char gender; //'M' or 'F' Date* admission_date; public: Patient(string name="", string ID="", int age=20, char gender='F', Date* date=nullptr){ this->name=name; this->ID = ID; this->age = age; this->gender = gender; admission_date=date; } ~Patient(){} string getName() { return name; } string getID() { return ID; } int getAge() { return age; } char getGender() { return gender; } Date* getAdmissionDate() { return admission_date; } /* Each patient has admission date. If the admission date is more than 10 days earlier than today, then it expires and returns true. Otherwise, it does not expire and returns false. */ bool isFreeAdmissionExpired(Date* today) { //add source code here... } }; class Hospital { private: vector
//Give me a thourough explaination on what everything is doing please. Thank you
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started