Question: write the code in object oriented programming c++ you should modify this code such that the passenger array you created inside the flight should be

write the code in object oriented programming c++
you should modify this code such that the passenger array you created inside the flight should be converted into a dynamically allocated array. Add a setter, a default constructor, and a destructor. Also, modify the existing constructors, parameterized and copy constructors.
write the code in object oriented programming c++ you should modify this
code such that the passenger array you created inside the flight should
be converted into a dynamically allocated array. Add a setter, a default
constructor, and a destructor. Also, modify the existing constructors, parameterized and copy
_______________________________________
constructors. _______________________________________ _______________________________________ _______________________________________ QUESTION 1: Implement class MyDate that represents the
date, this class should: 1) Encapsulate information about the day, month, year,
2) Forbid invalid dates, where the following criteria should be considered: -
Days are in the range [131]. - Months are in the range
_______________________________________
[112]. - Years are not less than 1900. If any forbidden value
entered, you should set the value to default value. 3) Two different
constructors (defaulted and parameterized) 4) Appropriate setters and getters for the encapsulated
information (data members) Test your class with a simple driver that defines
_______________________________________
a valid and an invalid date. Use separate implementation. \#ifndef MYDATE_H \#define
MYDATE_H using namespace std; class MyDate \{ private: static const int DEFAULT_DAY
=1; static const int DEFAULT_MONTH =1; static const int DEFAULT_YEAR =1900; int

QUESTION 1: Implement class MyDate that represents the date, this class should: 1) Encapsulate information about the day, month, year, 2) Forbid invalid dates, where the following criteria should be considered: - Days are in the range [131]. - Months are in the range [112]. - Years are not less than 1900. If any forbidden value entered, you should set the value to default value. 3) Two different constructors (defaulted and parameterized) 4) Appropriate setters and getters for the encapsulated information (data members) Test your class with a simple driver that defines a valid and an invalid date. Use separate implementation. \#ifndef MYDATE_H \#define MYDATE_H using namespace std; class MyDate \{ private: static const int DEFAULT_DAY =1; static const int DEFAULT_MONTH =1; static const int DEFAULT_YEAR =1900; int day; int month; int year; bool isvalidDate(int d, int m, int y) const; public: MyDate () ; MyDate(int d, int m, int y ); void setDate(int d, int m, int y ); int getDay() const; int getMonth() const; int getYear() const; \}; \#endif \#include "MyDate.h" \#include bool MyDate: isvalidDate(int d, int m, int y) const \{ if (y12d \#include using namespace std; class Passenger \{ private: const string firstName; const string lastName; const string dateofBirth; const string nationality; const int id; public : Passenger(const string\& firstName, const string\& lastName, const string\& dateofBirth, const string\& nationality, int id); const string\& getFirstName() const; const string\& getLastName() const; const string\& getDateofBirth() const; const string\& getNationality() const; int getID() const; void printDetails() const; \}; \#endif \#include "Passenger.h" Passenger::Passenger(const string\& firstName, const string\& lastName, const string\& dateofBirth, const string\& nationality, int id) : firstName(firstName), lastName(lastName), dateofBirth(dateofBirth), nationality (nationality), id(id) \{\} const string\& Passenger::getFirstName() const \{ return firstName; \} const string\& Passenger::getLastName() const \{ return lastName; \} const string\& Passenger::getDateofBirth() const \{ return dateofBirth; \} const string\& Passenger::getNationality() const \{ return nationality; \} int Passenger::getID() const \{ return id; \} void Passenger::printDetails() const \{ cout "

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!