954,504 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

another do my homework for me thread

You are welcome!


Simulation of an Airport Runway

An airport is developing a computer simulation of air-traffic control, which handles events such as landings and take-offs. It is a small busy airport with only one runway. In each unit of time one plane can land or one plane can take off, but not both. Planes arrive ready to land or to take off at random times, so at any given unit of time, the runway may be idle or a plane may be landing or taking off. There may be several planes waiting either to land or to take off. Follow the steps given below to design the program.

1. Create two queues one for the planes landing and the other for planes taking off.

2. Get the maximum number of units for which the simulation program would run.

3. Get the expected number of planes arriving in one unit and number of planes ready to take off in one unit .

4. To display the statistical data concerning the simulation, declare following data members.

a) idletime - to store the number of units the runway was idle

b) landwait - to store total waiting time required for planes landed

c) nland - to store number of planes landed

d) nplanes - to store number of planes processed

e) nrefuse - to store number of planes refused to land on airport

f) ntakeoff - to store number of planes taken off

g) takeoffwait - to store total waiting time taken for take off

Initialize the queue used for the plane landing and for the take off

Get the data for , and from the user.

The process of simulation would run for many units of time, hence run a loop in main() that would run from to where would be 1 and would be the maximum number of units the program has to be run.

Generate a random number. Depending on the value of random number generated, perform following tasks.

1. If the random number is less than or equal to 1 then get data for the plane ready to land. Check whether or not the queue for landing of planes is full. If the queue is full then refuse the plane to land. If the queue is not empty then add the data to the queue maintained for planes landing.

2. If the random number generated is zero, then generate a random number again. Check if this number is less than or equal to 1. If it is, then get data for the plane ready to take off. Check whether or not the queue for taking a plane off is full. If the queue is full then refuse the plane to take off otherwise add the data to the queue maintained for planes taking off.

3. It is better to keep a plane waiting on the ground than in the air, hence allow a plane to take off only, if there are no planes waiting to land.

4. After receiving a request from new plane to land or take off, check the queue of planes waiting to land, and only if the landing queue is empty, allow a plane to take off.

5. If the queue for planes landing is not empty then remove the data of plane in the queue else run the procedure to land the plane.

6. Similarly, if the queue for planes taking off is not empty then remove the data of plane in the queue else run the procedure to take off the plane.

7. If both the queues are empty then the runway would be idle.

8. Finally, display the statistical data as given below.

Total number of planes processed

Number of planes landed:

Number of planes taken off:

Number of planes refused use:

Number of planes left ready to land:

Number of planes left ready to take off:

Percentage of time the runway was idle:

Average waits time to land:

Average waits time to take off:

david7
Newbie Poster
2 posts since Jan 2009
Reputation Points: 7
Solved Threads: 0
 

i need it in two days

david7
Newbie Poster
2 posts since Jan 2009
Reputation Points: 7
Solved Threads: 0
 

Hurry up!!!

jencas
Posting Whiz
366 posts since Dec 2007
Reputation Points: 395
Solved Threads: 71
 

Man, u gon pay money to ppl for doin ya homework or what?

da penguin
Newbie Poster
18 posts since Dec 2008
Reputation Points: 36
Solved Threads: 5
 

How 'bout you hurry up and get me my code....PLZ PPLZ!

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Well thank you!
I like programming as a hobby and you have given me a nice project to work on!
Let you know when it's finished but it certainly won't be in two days.
Deadlines, man how I hated those deadlines when I was still programming professionally...

ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
 

Is there a way to remove these threads altogether? It really pollutes the forums.

Dave

daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
 
http://www.quotationspage.com/quote/22644.html I love deadlines. I love the whooshing sound they make as they fly by.


.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 
#include <iostream>
#include <windows.h>
#include <ctime>

using namespace std;

int main(void){
    int hours = 36;
    int mins = 57;
    int secs = 58;
    while(1){
        system("cls");
        if(hours > 0 || mins > 0 || secs > 0){
            cout << "Deadline in: " << hours << "h" << mins << "m" << secs << "s";
            if(mins == 0){
                if(hours != 0){
                    mins = 59;
                    hours -= 1;
                }
            }
            if(secs == 0){
                if(mins != 0){
                    secs = 59;
                    mins -= 1;
                }else{
                    if(hours != 0){
                        hours -=1;
                        mins = 59;
                        secs = 59;
                    }
                }
            }else secs -= 1;
            Sleep(CLOCKS_PER_SEC-30);
        }else break;
    }
    system("cls");
    cout << "Assignment Due!!!!";
    cin.get();
    return 0;
}
Freaky_Chris
Master Poster
702 posts since Apr 2008
Reputation Points: 325
Solved Threads: 118
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You