Dstoner 0 Newbie Poster

Can someone help me design the algorithm for this project. I am not asking for any code, just a plan of atack.

Option 3

Purpose:
The purpose of this programming assignment is to pull together all the programming skills of this semester. The assignment will be an exercise in problem solving, class design, methods, event-driven applications, graphics, exception handling, file pro cessing, Strings, linked lists, and threads.

Preparation:
In your textbook, you should read sections: 20.1 20.6 and 16.1 16.8 which are about the two new topics: linked lists and threads. In class we have been and will continue to cover several concepts which will help you to write this program.

Basic Problem:
Using a JFrame or JApplet create a program that will create moving balls. Balls will bounce off the walls of the window and show collision effects when they collide with other balls. Information about the balls will be written to a file and be display ed in the program.

Requirements:
The Ball class will be abstract and extend the Thread class. There will be two concrete subclasses of the Ball class: BouncyBall and ExplodingBall. Balls will be created by mouse clicks. The balls initial position will be at the point of the mouse cli ck. When a ball is created, the ball will be added to a synchonized LinkedList (see page 1053 of your textbook), the ball will either be a BouncyBall or an ExplodingBall which will be determined randomly, the ball will have a random direction that is not perfectly horizontal or vertical, it will also be given a random diameter in a range from 5 to 35 pixels and a random color, and an integer ID (the first balls ID is 1, the second balls ID is 2, ...). Balls will displayed as filled circles.

BouncyBalls will bounce off balls when they collide, and ExplodingBalls will explode and then reform. A ball colliding with a larger ball will lose 2 pixels of diameter. A ball colliding with an equal size or smaller ball will lose 1 pixel in diamete r. Anytime a ball has a diameter of 2 or less pixels, it disappears and is removed from the LinkedList. Collisions will be detected through traversing the LinkedList. All collisions and wall bounces will be written to file with ball ID information when they occur. All collisions will be written to a scrollable JTextArea. The user will be able to stop the program at any time using a stop button. At that point the file will be read, and a report will be generated that counts the number of collisions and wall bounces for each ball.

Expectations in Quality:
It is expected that you turn in high quality work. Your code should be well-documented, adhere to coding standards, be well-tested, and on-time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.