Programming Assignment #3

CSE 452: Fall 2004

Due Date: 12/09/04

Instructions: This programming assignment is designed to develop your Java and OO programming skills. The deliverable for this assignment include a standalone Java applet, and an additional file that is to be produced using word processing software like MS Word that will contain a step-by-step walkthrough demonstrating the capabilities of your applet. In addition, a “README” file should be provided if there are any special instructions that are required to run your program. All files are to be handed-in by email to by midnight on the due date shown.

Overview:

The goal of this assignment is to simulate the programming of an embedded system. In this case, you will be designing a standalone Java applet that will simulate the functioning of automatic door locks and power window controls. Your applet must contain controls to roll windows up and down and to control the door locks. Indicators should be used to show how far up or down each of four windows is, and whether each of four doors is locked or unlocked.

Quick-Start Guide to Java:

It is unnecessary to use “adriatic” for this assignment. You may use “arctic” or “pacific” if you wish to compile and run your applets. Please include explicit instructions on how to load and run your applet. Programs not explicitly documented will lose a considerable number of points! You may use any development environment you wish for your applet, but it must run on “arctic” in order to receive any points. So make sure to verify correct functioning on “arctic” before handing in your program.

You can download the Java Development Kit (JDK) for you personal computer for free at: There are many Java tutorials on the web, so feel free to use these to become familiar with the language. Here are a few to help you get started.

To compile a Java file on “arctic” simply type “javac filename” at the shell prompt. To run a compiled Java file, type “java filename” at the prompt.

Programming Assignment Specifications: (100 pts.)

You are free to be creative in how you put your simulator together. Clarity, ease of use, and robustness will count as “quality of solution” points for this assignment. There are however, certain minimum characteristics that your simulator should have. These include:

  1. Use pushbuttons for controlling your windows. Windows should go up or down depending on the button pushed, until the button is released. There should be an “up limit” and “down limit” so that your window does not go up or down forever. Remember, you need a set of buttons for each of four windows. In addition, include a set of controls for the other 3 windows in the driver’s side set (again, just like in a typical automobile).
  2. Use radio or pushbuttons to toggle each of four doors between locked and unlocked. You should also have an “all door lock” and “all door unlock” pushbuttons, just as you would in an automobile. Doors locked using “all locked” should be able to be manually unlocked if desired.
  3. You should include a “window lock” button for the driver’s side window. Pushing this button should prevent all of the other window controls from functioning, except for the driver’s side controls.
  1. Include a status display at the top of your simulator to show the action currently being taken.
  1. Some sort of indicator should be provided for each window to indicate how far up or down the window is. Similarly, the locking status of each door should also be displayed with some sort of indicator.
  1. Your program design must utilize multiple threads of execution (at least two). Use of these threads should accomplish some logical purpose within your program. Clearly describe in your “readme” file where these threads have been incorporated and their purpose. One source on Java threads can be found at:
  1. Make sure to include a “readme” file that describes how to run your program and how to operate the interface of the simulator.

Extra Credit: (20 pts.)

Include a sensor for each window that measures the amount of resistance encountered. This resistance sensor should be used to detect the presence of obstacles located in the path of the rolling window. When the resistance exceeds some level, the window should stop rolling up (e.g., if a child’s head were in the way). Please explicitly state the system invariant that should be satisfied in order for the window to either stop or continue rolling. Hint: The use of this sensor could also be integrated to control the up and down limits of the rolling windows. You will also need to incorporate some sort of obstacle mechanism into your design to permit testing of the resistance sensor (i.e., a way to place an obstacle in the path of the rolling window).