Add folowing given description to the below given C++ program Description: Add a member function delayFlight(int) in the Flight class to delay the flight by the number of minutes pass as input to this function. (For simplicity, assume that delaying a flight will not change the Date).  Add a member function reserveSeat(int) which reserves the number of seats passed as input to this function. Display appropriate message to the user if the seats are not available.  Write a main program to test the functionality of your Flight class.  Write a driver code to test these functionalites.   Program Code: #include #include #include   using namespace std;   class Date { private:     int day;     int month;     int year; public:     Date()     {         day = 0;         month = 0;         year = 0;     }     Date(int alpha, int beta, int charlie)     {         day = alpha;         month = beta;         year = charlie;     }     void setDay(int day)     {         this->day = day;     }     void setMonth(int month)     {         this->month = month;     }     void setYear(int year)     {         this->year = year;     }     int getDay()     {         return day;     }     int getMonth()     {         return month;     }     int getYear()     {         return year;     }       void Display()     {         cout << day << "/" << month << "/" << year << endl;     } };   class Time { private:     int sec;     int min;     int hour; public:     Time()     {         sec = 0;         min = 0;         hour = 0;     }     Time(int alpha, int beta, int charlie)     {         sec = alpha;         min = beta;         hour = charlie;     }     void setSec(int sec)     {         this->sec = sec;     }     void setMin(int min)     {         this->min = min;     }     void setHour(int hour)     {         this->hour = hour;     }     int getSec()     {         return sec;     }     int getMin()     {         return min;     }     int getHour()     {         return hour;     }       void Display()     {         cout << hour << ":" << min << ":" << sec << endl;     } };   class Flight { private:     Date dept;     Date arrl;     Time depart;     Time arrival;     int flightID;     string fltStatus;     int totalSeats;     int reservedSeats;   public:     Flight()     {         flightID = 0;         totalSeats = 0;         reservedSeats = 0;         fltStatus = "";     }       Flight(int a, int b, int c, string d)     {         flightID = a;         totalSeats = b;         reservedSeats = c;         fltStatus = d;     }       void setFlightID(int ID)     {         flightID = ID;     }     void setTotalseats(int seats)     {         totalSeats = seats;     }     void setReservSeats(int res)     {         reservedSeats = res;     }     void setStatus(string state)     {         fltStatus = state;     }       int getflightID()     {         return flightID;     }     int getTotalseats()     {         return totalSeats;     }     int getreserveSeats()     {         return reservedSeats;     }     string getStatus()     {         return fltStatus;     }       void Display()     {         cout << "Flight ID: " << flightID << endl;         cout << "Flight Total Seats: " << totalSeats << endl;         cout << "Reserved seats: " << reservedSeats << endl;         cout << "Flight Status: " <

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Add folowing given description to the below given C++ program

Description:

  • Add a member function delayFlight(int) in the Flight class to delay the flight by the
    number of minutes pass as input to this function. (For simplicity, assume that delaying a flight
    will not change the Date).
  •  Add a member function reserveSeat(int) which reserves the number of seats passed as
    input to this function. Display appropriate message to the user if the seats are not available.
  •  Write a main program to test the functionality of your Flight class.
  •  Write a driver code to test these functionalites.

 

Program Code:

#include <iostream>

#include <conio.h>

#include <string>

 

using namespace std;

 

class Date

{

private:

    int day;

    int month;

    int year;

public:

    Date()

    {

        day = 0;

        month = 0;

        year = 0;

    }

    Date(int alpha, int beta, int charlie)

    {

        day = alpha;

        month = beta;

        year = charlie;

    }

    void setDay(int day)

    {

        this->day = day;

    }

    void setMonth(int month)

    {

        this->month = month;

    }

    void setYear(int year)

    {

        this->year = year;

    }

    int getDay()

    {

        return day;

    }

    int getMonth()

    {

        return month;

    }

    int getYear()

    {

        return year;

    }

 

    void Display()

    {

        cout << day << "/" << month << "/" << year << endl;

    }

};

 

class Time

{

private:

    int sec;

    int min;

    int hour;

public:

    Time()

    {

        sec = 0;

        min = 0;

        hour = 0;

    }

    Time(int alpha, int beta, int charlie)

    {

        sec = alpha;

        min = beta;

        hour = charlie;

    }

    void setSec(int sec)

    {

        this->sec = sec;

    }

    void setMin(int min)

    {

        this->min = min;

    }

    void setHour(int hour)

    {

        this->hour = hour;

    }

    int getSec()

    {

        return sec;

    }

    int getMin()

    {

        return min;

    }

    int getHour()

    {

        return hour;

    }

 

    void Display()

    {

        cout << hour << ":" << min << ":" << sec << endl;

    }

};

 

class Flight

{

private:

    Date dept;

    Date arrl;

    Time depart;

    Time arrival;

    int flightID;

    string fltStatus;

    int totalSeats;

    int reservedSeats;

 

public:

    Flight()

    {

        flightID = 0;

        totalSeats = 0;

        reservedSeats = 0;

        fltStatus = "";

    }

 

    Flight(int a, int b, int c, string d)

    {

        flightID = a;

        totalSeats = b;

        reservedSeats = c;

        fltStatus = d;

    }

 

    void setFlightID(int ID)

    {

        flightID = ID;

    }

    void setTotalseats(int seats)

    {

        totalSeats = seats;

    }

    void setReservSeats(int res)

    {

        reservedSeats = res;

    }

    void setStatus(string state)

    {

        fltStatus = state;

    }

 

    int getflightID()

    {

        return flightID;

    }

    int getTotalseats()

    {

        return totalSeats;

    }

    int getreserveSeats()

    {

        return reservedSeats;

    }

    string getStatus()

    {

        return fltStatus;

    }

 

    void Display()

    {

        cout << "Flight ID: " << flightID << endl;

        cout << "Flight Total Seats: " << totalSeats << endl;

        cout << "Reserved seats: " << reservedSeats << endl;

        cout << "Flight Status: " <<fltStatus << endl;

        cout << "Date of Deperture: ";

        dept.Display();

        cout << "Time of Departure: ";

        depart.Display();

        cout << "Date of Arrival: ";

        arrl.Display();

        cout << "Time of Arrival: ";

        arrival.Display();

    }

 

};

 

 

 

 

int main()

{

 

 

    _getch();

    return 0;

}

 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY