another do my homework for me thread

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 2
Reputation: david7 is an unknown quantity at this point 
Solved Threads: 0
david7 david7 is offline Offline
Newbie Poster

Re: Need Help in Writing An Airport simulation program.

 
0
  #1
Jan 12th, 2009
Originally Posted by ArkM View Post
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 <endtime> for which the simulation program would run.



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



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 <endtime>, <expectarrive> and <expectdepart> from the user.



The process of simulation would run for many units of time, hence run a loop in main() that would run from <curtime> to <endtime> where <curtime> would be 1 and <endtime> 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:
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 2
Reputation: david7 is an unknown quantity at this point 
Solved Threads: 0
david7 david7 is offline Offline
Newbie Poster

Re: Need Help in Writing An Airport simulation program.

 
-1
  #2
Jan 12th, 2009
i need it in two days
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 360
Reputation: jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice 
Solved Threads: 69
jencas jencas is offline Offline
Posting Whiz

Re: another do my homework for me thread

 
0
  #3
Jan 12th, 2009
Hurry up!!!
If you are forced to reinvent the wheel at least try to invent a better one!

Please use code tags - Please mark solved threads as solved
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 18
Reputation: da penguin is an unknown quantity at this point 
Solved Threads: 5
da penguin's Avatar
da penguin da penguin is offline Offline
Newbie Poster

Re: another do my homework for me thread

 
1
  #4
Jan 12th, 2009
Man, u gon pay money to ppl for doin ya homework or what?
No, ma'am, we are musicians.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: another do my homework for me thread

 
0
  #5
Jan 12th, 2009
How 'bout you hurry up and get me my code....PLZ PPLZ!
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,923
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 276
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: another do my homework for me thread

 
0
  #6
Jan 12th, 2009
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...
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 628
Reputation: daviddoria is a jewel in the rough daviddoria is a jewel in the rough daviddoria is a jewel in the rough 
Solved Threads: 46
daviddoria daviddoria is offline Offline
Practically a Master Poster

Re: another do my homework for me thread

 
2
  #7
Jan 12th, 2009
Is there a way to remove these threads altogether? It really pollutes the forums.

Dave
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: another do my homework for me thread

 
1
  #8
Jan 12th, 2009
Originally Posted by Douglas Adams
http://www.quotationspage.com/quote/22644.html
I love deadlines. I love the whooshing sound they make as they fly by.
.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 670
Reputation: Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough 
Solved Threads: 113
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is offline Offline
Practically a Master Poster

Re: another do my homework for me thread

 
0
  #9
Jan 12th, 2009
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main(void){
  8. int hours = 36;
  9. int mins = 57;
  10. int secs = 58;
  11. while(1){
  12. system("cls");
  13. if(hours > 0 || mins > 0 || secs > 0){
  14. cout << "Deadline in: " << hours << "h" << mins << "m" << secs << "s";
  15. if(mins == 0){
  16. if(hours != 0){
  17. mins = 59;
  18. hours -= 1;
  19. }
  20. }
  21. if(secs == 0){
  22. if(mins != 0){
  23. secs = 59;
  24. mins -= 1;
  25. }else{
  26. if(hours != 0){
  27. hours -=1;
  28. mins = 59;
  29. secs = 59;
  30. }
  31. }
  32. }else secs -= 1;
  33. Sleep(CLOCKS_PER_SEC-30);
  34. }else break;
  35. }
  36. system("cls");
  37. cout << "Assignment Due!!!!";
  38. cin.get();
  39. return 0;
  40. }
Last edited by Freaky_Chris; Jan 12th, 2009 at 7:00 pm.
Knowledge is power -- But experience is everything
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC