Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c++ language Task (Inheritance and Polymorphism) ***Important Notes*** 1) Submission to be via eLearning ONLY 2) No submissions via email 3) No submissions after

using c++ language
image text in transcribed
image text in transcribed
image text in transcribed
Task (Inheritance and Polymorphism) ***Important Notes*** 1) Submission to be via eLearning ONLY 2) No submissions via email 3) No submissions after deadline 4) Zip your project/code (cpp + header files) into 1 single ZIP file called 20xyz-Assignment2.zip (or .rar) where 20xyz is your ID. File name should be: your ID_OOP_HW3.zip, e.g. 20140210_OOPHW3.zip Write your Name and ID number in the main code file as well. Any function that can be declared constant should be done so. 7) Make any necessary validations to inputs 8) Clean the heap as often as necessary Homework Description In your Holidays system, Flights can be categorised into: Outbound and Inbound Date class has int attributes for Day, Month and Year. All Flight objects have attributes: const int FlightNumber, // drawn from a static serial number starting from 1. string Destination; Date *Flight_Date; //from Date class - Use Heap to store it and clean it in the destructor double *Take-Off-Weight; //Use heap to store it and clean in in the destructor Flight.h is given here: IA #include using namespace std; #include "Date.h" class Flight static int serial; protected: int Passengers: Flight.h is given here: #include using namespace std; #include "Date.h" class Flight static int serial; protected: int Passengers; const int FlightNumber: string Destination: Date "Flight_Date; double *Take-Off-Weight; public: Flight: Flight(string dest, Date fdate, double weight, int pass); virtual void SetValues(string dest, Date fdatc, double weight, int pass); virtual double Calaculate Cost0 = 0; virtual void PrintDetails() = 0; virtual - Flight(); }; Outbound Flights have the additional attributes: double Tax; //Use heap to store it and clean in in the destructor string* Stop-Over, Ile.g., Doha, Madrid, Istanbul), Use heap to store it and clean in the destructor Inbound Flights have the additional attributes: Double *Fuel-Load: //Use heap to store it and clean in in the destructor string *Bound-To;/(e.g., Doha, Madrid, Istanbul) - Use heap to store it and clean in in the destructor 1/=Date Class Header class Date private: int day: int month; int year, public: Date(); Date(int, int, int); string *Bound-To: /e.g., Doha, Madrid, Istanbul) - Use heap to store it and clean in in the destructor Date Class Header class Date 1 private: int day int month; int year, public: Datel); Date(int, int, int): void set Day(int): int getDay: void set Month(int); int get Month : void setYear(int): int getYear(); -Date: ***Requirements*** Part 1 1) Code all classes 2) Declare as many attributes as privats as possible >> Pass parameters as const as much as possible 4) Separate class interface and implementation 5 You can use String library Do NOT create pointers of type Inbound or Outbound. All pointers must be of type Flight 7) Use Dynamic Memory where possible * Create the base class Flight as above, note: Pure virtual function to print details by Pure virtual function Calaculate_Cost as follows: Inbound: weight *0.4 + Fuel-Load 3.25 Passengers 100; Outbound weight 0.38 + Tax 1.5 * Passengers * 100. Create derived classes Inbound + Outbound as above with the following functionalities: Constructors to initialize the data members b) Destructors to perform garbage collection and resets Functions to print details including those inherited from base class d: Functions to calculate Cost Part 2 Write a program to test drive your classes. Deadline is 2pm on Thursday 14 Jan 2021 Good luck! AEH

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions