CCSU Summer, Second 5, 1999 Project 1 -- DUMMY FILE, NOT THE REAL PROJECT Posting Date: July 12, 1999 Due Date: July 22, 1999 Relevant Demos: Demo 14 (MovingSquareThread.java) and Demo 15 (ThreadPracticeC.java). Introduction: This project covers the material on Animation and Threads. Write a "Bouncing Squares" application. The Bouncing Squares application should be similar in appearance to Sun Microsystem's Bouncing Ball and Bouncing Head Java Demos, except that there should be many Bouncing Squares. (The Bouncing Ball and Bouncing Head Demos come with the JDK in the Demos folder, and they are also browsable from the Sun Java Documentation page.) -------------- Basically, a BouncingSquare is a Square which | | moves inside a box. When it hits a wall it | -- \| bounces off, following the familiar "angle of | | | --| incidence equals angle of reflection" law of | -- | | optics. In fact, real physical balls would | --| behave this way in the absence of spin and | /| friction. The diagram to the left illustrates --------------- a box containing two Bouncing Squares. One of the Squares has just hit a wall and is bouncing off. The approximate directions of motion just before and just after the bounce are illustrated by diagonal lines. Detailed Specifications: 1. Each BouncingSquare should be a separate object running on a separate Thread. 2. Your application should have a Launch Button for launching BouncingSquares. 3. BouncingSquares should be launched from random positions inside the box in random directions. The random directions are North, North East, East, South East, South, South West, West, and North West, that is vector directions (0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), and (-1, -1). 4. Squares moving along diagonal directions may move faster than squares moving horizontally or vertically. 5. When a new BouncingSquare is launched, your application should lose the reference to the old BouncingSquare objects. 6. Your BouncingSquares should continue to bounce forever, or until the Java Garbage Collector eliminates them. 7. Your animation must run smoothly. General Instructions: (1) Hand in a FOLDER--the kind with a pocket, you can buy them in the bookstore--with YOUR NAME on it, containing in the pocket (1) the cover sheet described below, (2) a printed copy of your source code, and (3) a 3.5" floppy disk with the .java and .class files for your project. (2) Each of your program files must begin with a remark box containing the following information, formatted as indicated: PROGRAMMER: Your name. DATE: Current date. COURSE: Course number and semester (CS 407 MultiTasking, Summer 1999). PROJECT: Project number (Project 1 in this case). PROGRAM: Program name (use the main class name). DESCRIPTION: A brief description of what the program does. FILES: The files your program uses (probably none in this case). LANGUAGE: Java JDK version you used. (3) You must hand in a PAPER cover sheet in your folder telling me YOUR NAME: Your name. DATE: As above. COURSE: As above. PROJECT: As above. MAIN APPLICATION FILE NAME: The name I type to compile and/or launch your application. (4) Each class should begin with a remark box containing class and object design documentation, as illustrated in the demos. (5) Each method in your program must begin with a remark box, as illustrated in the demos. (6) Your program MAY NOT use a depreciated api. (If you do, a compiler warning message comes up. Usually, this means you used Java 1.0 rather than Java 1.1 event handling.)