CSE 283 Introduction to Object Oriented Design

Barbara Nostrand, Ph.D.


CSE 283 Labs
Welcome to the site for CSE 283 Labs!

 

Lab 13: Projects

Prev | Next | Lab 13

 

Objectives

1. Practice using threads.
2. Practice designing and implementing simulations.

Introduction

Each of the following projects involves the use of threads in a real-time simulation. Your instructor will tell you which of them you are to do, and will provide any input files to be used to test your program.

Projects

13.1. Modify the simulation from the lab exercise so that each Teller has its own line. Add input statements to the simulation so that the minimum and maximum time between customers and the minimum and maximum time for a customer transaction are entered by the user at the start of the simulation.

13.2. Write a simulation that determines the average time for all contestants in a game of tag to be caught. Model the problem with a 2D grid. Each spot on the grid is a possible position. Contestants can move in any of the four cardinal directions. One contestant starts out as the chaser. All other contestants are evaders. If a chaser and an evade end up on the same grid point, the evader becomes a chaser too. Contestants should move in a random direction at given intervals.

Extra credit: Create different classes of contestants. Possibilities include: smart chasers which will move towards an evader that is close to it, smart evaders who move away from any chaser that is close, and faster runners that move more often.

13.3. Write a simulation that determines the average wait time at a traffic light. Cars arrive at the traffic light in any one of the four directions. If the light is green, the cars will line up behind any cars traveling in that direction which have not passed through the intersection. If the light is yellow or red, the cars will line up and wait. When the light turns green, the waiting cars will travel through the intersection one at a time every 3 seconds.

13.4. Write a simulation that determines the average time to handle a hard disk request. Information on a disk drive is stored in circular tracks. Requests for information will come to the disk drive at random intervals. There is a head that moves over the tracks and retrieves the information. To move the head from one track to the adjacent track will take 100 milliseconds. To access the information once the head is at the correct track takes 20 milliseconds. Implement two policies for handling disk requests.

  1. Requests are handled first come, first serve.
  2. The disk head scans across the disk from low numbered tracks to high numbered tracks. As it comes to each track it will handle the requests for that track. When it reaches the last track, it goes all the way back to the beginning.

Don't forget to clean up your directory when you are all finished...

Prev | Next | Lab 13

 
  Home

Schedule

Help

Lab 0

Lab 1

Lab 2

Lab 3

Lab 4

Lab 5

Lab 6

Lab 7-8

Lab 9

Lab 10

Lab 11

Lab 12

Lab 13






Last modified: 2007 OCT 28
bnostran@syr.edu