i know it's too much long but i really need some help to fix the program errors , am stuck within whole code lines and ma mind went confused .. it's airport simulation program
the airport has one runway .. one plane can land and one plane can fly but not both in same time.the plans are waiting kept in 2 queues for landing and taking off.

#include <iostream>
#include <time.h>
#include "random"
using namespace std;
enum Runway_activity { idle, land, flyingoff };
enum plane_status { null, arriving, departing };
struct queuetype{
    int front, rear;
};
class Plane
    {
        private:
            int f_num; int clock_start;
            int state;
        public:
            Plane()

                {
                        f_num = -1;
                        clock_start = -1;
                        state = null;
                }
            Plane(int flight, int time,int status)
                {
                    f_num = flight;
                    clock_start = time;
                    state = status;
                    cout << " Plane number " << flight << " ready to ";
                    if (status == arriving)
                        cout << "land." << endl;
                    else
                        cout << "take off." << endl;
                }
            void refuse() const
                {
                    cout << " Plane number " << f_num;
                    if (state == arriving)
                        cout << " directed to another airport" << endl;
                    else
                        cout << " told to try to takeoff again later" << endl;
                }
            void land(int time) const
               {
                    int wait = time - clock_start;
                    cout << time << ": Plane number " << f_num << " landed after ";
                    cout<<wait<<" time unit"<<((wait==1) ? "" : "s");
                    cout << " in the takeoff queue." << endl;
                }
            void fly(int time) const
                {
                        int wait = time - clock_start;
                        cout << time << ": Plane number " << f_num;
                        cout << " took off after ";
                        cout << wait << " time unit" << ((wait == 1) ? "" : "s");
                        cout << " in the takeoff queue." << endl;
                }
            int empty(queuetype q){
                if (q.front == q.rear)
                    return 1;
                else
                    return 0;
            }
            int started() const { return clock_start; }

    }; 
class Runway
{
        private:
            int queue_limit;
            int num_land_requests; // number of planes asking to land
            int num_takeoff_requests; // number of planes asking totake off
            int num_landings; // number of planes that have landed
            int num_takeoffs; //number of planes that have taken off
            int num_land_accepted; // number of planes queued to land
            int num_takeoff_accepted; // number of planes queued to take off
            int num_land_refused; // number of landing planes refused
            int num_takeoff_refused; // number of departing planes  refused
            int land_wait; //total_time of planes_waiting to land
            int takeoff_wait; //total_time of planes_waiting to take off
            int idle_time; //total_time runway is idle
        public:
            Plane landing;
            Plane takeoff;
            Runway(int limit)
                 {
                    queue_limit = limit;
                    num_land_requests = num_takeoff_requests = 0;
                    num_landings = num_takeoffs = 0;
                    num_land_refused = num_takeoff_refused = 0;
                    num_land_accepted = num_takeoff_accepted = 0;
                    land_wait = takeoff_wait = idle_time = 0;
                }
            int can_land(const Plane &current)
                  {
                        int result;
                        if (landing.size()<queue_limit)
                            result = landing.enqueue(current);
                        else
                            result = false;
                        num_land_requests++;
                        if (result != true) 
                            num_land_refused++;
                        else 
                            num_land_accepted++;
                        return result;
                  }
            int can_depart(const Plane &current)
            {
                    int result;
                    if (takeoff.size() < queue_limit)
                    result = takeoff.enqueue(current);
                    else 
                        result = false;
                    num_takeoff_requests++;
                    if (result != true) 
                        num_takeoff_refused++;
                    else
                        num_takeoff_accepted++;
                    return result;
            }
            Runway_activity activity(int time, Plane &moving)
            {
                Runway_activity in_progress;
                if (!landing.empty())
                {
                    landing.dequeue(moving);
                    land_wait += time - moving.started();
                    num_landings++; in_progress = land;
                    landing.serve();
                }
                else if (!takeoff.empty())
                    {
                        takeoff.dequeue(moving);
                        takeoff_wait += time - moving.started();
                        num_takeoffs++; in_progress = flyingoff;
                        takeoff.serve();
                    }
                    else{
                        idle_time++;
                        in_progress = idle;
                    }
                    return in_progress;
            }

            void finish(int time) const; 

}; 
void initialize(int&, int&, double&, double&);
void run_idle(int);

void main() 
{
    int end_time; //time to run simulation
    int queue_limit; //size of Runway queues
    int flight_number = 0;
    double arrival_rate, departure_rate;
    start(end_time, queue_limit, arrival_rate,departure_rate);
    random variable;
    Runway airport(queue_limit);
    for (int current_time = 0; current_time<end_time; current_time++)
    {
        int number_arrivals = variable.poisson(arrival_rate);
        for (int i = 0; i<number_arrivals; i++){
            Plane current_plane(flight_number++, current_time, arriving);
            if (airport.can_land(current_plane) != true)
                current_plane.refuse();
        }
        int number_departures = variable.poisson(departure_rate);
        for (int j = 0; j<number_departures; j++)
        {
            Plane current_plane(flight_number++,current_time,departing);
            if (airport.can_depart(current_plane) != true)
                current_plane.refuse();
        }Plane moving_plane;
        switch (airport.activity(current_time,moving_plane))
        {
        case land: moving_plane.land(current_time); break;
        case flyingoff: moving_plane.fly(current_time); break;
        case idle: run_idle(current_time);
        }
    }
    airport.finish(end_time);
}



void start(int &end_time, int &queue_limit, double &arrival_rate, double &departure_rate)
{
    cout << "This program simulates an airport with onlyone runway. ";
    cout << "One plane can land or depart in each unit of time.\n";
    cout << "number of planes can be waiting to land or take off at any time : " ;
    cin >> queue_limit;
    cout << "How many units of time will the simulation run?\n";
    cin >> end_time;
    bool acceptable;
      do{  
        cout << "Expected number of arrivals per unit time :";
        cin >> arrival_rate;
        cout << "Expected number of departures per unit time :";
        cin >> departure_rate;
        if (arrival_rate < 0.0 || departure_rate<0.0)
            cout << " These_rates must be positive. ";
        else
            acceptable = true;
        if (acceptable && arrival_rate + departure_rate>1.0){
             cout << "One plane can land or depart in each unit of time.\n";
        cout << "what number of planes can be waiting to land or take off at any time? ";
        cin >> queue_limit;
        cout << "How many units of time will the simulation run?\n";
        cin >> end_time;

        do{
            cout << "Expected number of arrivals per unit time ? ";
            cin >> arrival_rate;
            cout << "Expected number of departures per unit time?";
            cin >> departure_rate;
            if (arrival_rate < 0.0 || departure_rate<0.0)
                cout << " These_rates must be positive. " << endl;
            else
                acceptable = true;
            if (acceptable && arrival_rate + departure_rate>1.0)
                cout << "Safety Warning: This airport will become full";
        } while (!acceptable);
    }

}

void Runway::finish(int time) const
{

        cout << "\n\nSimulation has concluded after " << time;
        cout << " time units.\n Total number of planes processed ";
        cout << (num_land_requests + num_takeoff_requests) << endl;
        cout << "Total number of planes asking to land ";
        cout << num_land_requests << endl;
        cout << "Total number of planes asking to take off ";
        cout << num_takeoff_requests << endl;
        cout << "Total number of planes accepted for landing ";
        cout << num_land_accepted << endl;
        cout << "Total number of planes accepted for takeoff ";
        cout << num_takeoff_accepted << endl; cout << "Total number of planes refused for landing ";
        cout << num_land_refused << endl;
        cout << "Total number of planes refused for takeoff ";
        cout << num_takeoff_refused << endl;
        cout << "Total number of planes that landed ";
        cout << num_landings << endl;
        cout << "Total number of planes that took off ";
        cout << num_takeoffs << endl;
        cout << "Total number of planes left in landing queue ";
        cout << landing.size() << endl;
        cout << "Total number of planes left in takeoff queue ";
        cout << takeoff.size() << endl;
        cout << "Percentage of time runway idle " << (100.0*(float)idle_time) / ((float)time) << "%" << endl; 
        cout << "Average wait in landing queue "<< ((float)land_wait) / ((float)num_landings) << " time units " << endl;
        cout << "Average wait in takeoff queue"<< ((float)takeoff_wait) / ((float)num_takeoffs)<< "time units" << endl;
        cout << "Average observed rate of planes wanting to land";
        cout << ((float)num_land_requests) / ((float)time)<< " per time unit " << endl;
        cout << "Average observed rate of planes wanting to take off ";
        cout << ((float)num_takeoff_requests) / ((float)time) << " per time unit " << endl;

}

What part are you stuck on exactly?

Why does the Runway class have instantiated public member variables for Plane, landing and takeoff? It appears to me that you have not analyzed your use cases properly. Other beginner C++ issues - you have no default constructor, no copy constructor, or assignment operator. If not needed, then declare them as private, but don't implement them. If you don't do that, then the compiler will happily construct them for you, with unhappy results...

So, my analysis of your code is that you are just getting started in understanding C++ programming and need to do a lot more study before you are prepared to accomplish this assignment properly. I am a senior systems software engineer (contractor) at a tier-1 global company, and my predicessor was about at your level of C++ expertise. I have spent the past month sorting out his errors... And the company is paying me over $60 per hour to do that...

All of that stuff aside, do the most with the least. Each class should only contain variables that are relevant to their existence. You may have a Plane pointer to the next or current landing/taking-off entity in Runway, but they will NOT be fully instantiated members of the class object. GAH!

All of that said, as Suzie asked, what exactly IS your problem (other than the obvious)?

Oh .. 1st thxx for replying .. 2nd amstill student with little knowledge and experience
i tried to do my best .. but finally someone helped me in that .. i know i need more and more studying and practicing .. thx again :)

... airport simulation program
... the airport has one runway ..
one plane can land (or) one plane can fly (takeoff) but not both (at the) same time.
the (waiting) plans are kept in 2 queues
one for landing
one for taking off.

Is the above the totality of your supplied design spec's?

If not ...
it would help to supplied the complete and exact copy of the spec's you were given.

I suspect your design could be improved?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.