

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Lab; Class: ANALYSIS & DESIGN PATTERNS; Subject: Computer Science; University: University of Alabama - Huntsville; Term: Spring 2005;
Typology: Lab Reports
1 / 3
This page cannot be seen from the preview
Don't miss anything!
Air Traffic Controller Simulator CS 552 Program # Spring 2005 DUE: Monday, April 25 You will simulate an air traffic controller. The air traffic controller will keep track of one airplane. Only one airplane is specified in order to make things easier on you, programming wise. HOWEVER, if you implement 2 airplanes, you get + points added to your semester grade. This corresponds to +20 points on this program. NOTE that you must have at least an 80/100 base grade on this program in order to receive the extra credit. However, you will pretend that you have multiple airplanes running when you write your program even if you’re only using one. This will make some of the design patterns which you choose more applicable. The air traffic controller will keep track of height of airplane and location of airplane. Height will be specified in even thousands of feet, 1000, 2000, 3000, 4000, or 5000 feet. (You would not use 1500, 2001, etc. only 1000 or 2000). Only the numbers just specified will be used (that is, 1000, 2000, …, 5000). Location will be specified as N,S,E,W,NE,NW,SE,SW. The air traffic controller will be able to tell the airplane what height and location to change to, on command from the user. Input to the air traffic controller from the user can be either command line or GUI, whichever you prefer, but the interface has to be easy to understand. The airplane(s) will accept input from the air traffic controller and will print a message on the screen that it has changed height and location, as specified by the air traffic controller. Then it will send a confirmation message back to the air traffic controller, which will print that to the screen. You will simulate communication between the air traffic controller and the airplane(s) using socket programming. You will be provided a pair of simple socket programs, send and receive, that will send text data from one command prompt (DOS) window to another command prompt (DOS) window using a socket. NOTE: you’ll be working on only one computer. Don’t bother trying to make this work on more than one computer. One send/receive socket pair will be used for the air traffic controller. One send/receive socket pair will be used for each airplane. You will have one command prompt window for send and another for receive for the air traffic controller. You will have one command prompt window for send and another for receive for each airplane. Thus, the air traffic controller needs 2 windows, and each airplane needs 2 windows. NOTE: I’ve been assuming in this description that you’re doing only text input and output. If you use a GUI, then you’ll still be using windows but presumably they won’t be command prompt windows.
If you find you have to communicate between send and receive for any entity (air traffic controller or airplane), then I suggest you use a file to send the data. Write to the file from receive, for example, and read from the file for send. Note that there could potentially be race conditions related to both send and receive trying to write or read the same file at the same time. We’re not going to get into operating system-type things here, so just “fake” synchronization of processes by writing to a file in one process (window), then waiting a good long time to give the other process (window) time to get around to reading the file before the first process (window) tries to write to it again. You can use the Sleep routine here. See the socket code I’m providing you for an example of how to use Sleep. The socket programs I’m giving you are not object-oriented. You may need to wrap them in objects to use them, but that’s up to you, I’m not requiring that in particular. Your program has to be written in Microsoft Visual C++ version 6.0, and it has to compile and run in the CS lab. The maximum grade you will receive if your program doesn’t run is 15/100.