From a0dfcc5c0e33bc7b31ec96279b0f724a21dd6bec Mon Sep 17 00:00:00 2001 From: harshitha-85 <57164562+harshitha-85@users.noreply.github.com> Date: Wed, 30 Oct 2019 10:45:12 +0530 Subject: [PATCH] Simulator for air-traffic control at airport In the simulator, maximum allowed planes on the run-way is 3. --- plane.cpp | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 plane.cpp diff --git a/plane.cpp b/plane.cpp new file mode 100644 index 0000000..2193e7a --- /dev/null +++ b/plane.cpp @@ -0,0 +1,106 @@ +#include +#include +using namespace std; + +class aeroplane +{ + private: + string airline; + string dest; + static int count; + public: + aeroplane(string a,string d) + { + airline = a; + dest = d; + } + + string getAirline() + { + return airline; + } + + static int checkCount() + { + if(count<3) + return 1; + else + return 0; + } + + void landing() + { + cout<>ch; + switch(ch) + { + case 1: flag = aeroplane::checkCount(); + if(flag==0) + cout<<"Landing not Allowed since Runway is occupied"<>n; + cout<<"Enter the Destination of the Aeroplane :"<>d; + a[i] = new aeroplane(n,d); + a[i]->landing(); + i++; + } + break; + case 2: flag = aeroplane::giveCount(); + if(flag==0) + cout<<"No Flight currently on Runway to take off"<getAirline()<>f; + a[f-1]->takeOff(); + delete a[f-1]; + for(j=f-1;j