Here is the assignment any hints or tips would be awesome, but I am really stuck so help please. I will also attach my two other classes that are imported. If your wondering what anything is please just ask I will be checking this forum alot tonight. I have to have this in by 5 PM tomorrow. Im not asking you to write the program, but point me in the right direction please. Here was the original assignment.
Watching Particles Collide
For this programming assignment, you are going to read in a set of particles and, using a graphics object, illustrate the collisions. To simplify things, only the first particle wll be moving.
The initial input will consist of particle descriptions. Each particle will be described by four double values: the particle's x-coordinate, the particle's y-coordinate, the x component of the particle's velocity, and the y-component of the particle's velocity. The first particle will have a nonzero velocity, all remaining particles will have a zero velocity (in both components). The end of the input will be indicated by a particle with a velocity of -1 in both components (this particle is not considered to be part of the simulation).
Your job is to determine which particles the moving particle will collide with. We're going to make this very simple: when a moving particle collides with a stationary particle. The stationary particle gets bigger and the moving particle is unaffected (i.e., it keeps moving in the same direction and velocity). The computation ends, when there are no further collisions.
The output will consist of two parts. The output to theScreen should print the position of the collisions and the time at which they occur, ordered by the time of the collision. In addition to theScreen output, you should produce a graphical image of the collisions. In this image, you should draw a line that indicates the path taken by the moving particle and circles to indicate the position of the stationary particles. If a stationary particle is not involved in a collision, it should be drawn with a radius of 1; otherwise, it should be drawn with a radius of 2.
The Space class
The Space class is used to construct the image. This class provides a constructor and two methods: drawLine and drawCircle.
The constructor takes two double arguments: the maximum x-coordinate and the maximum y-coordinate -- for this exercise, you can use 100 and 100. As such, you can use the following code to construct an instance of the Space class:
mySpace = new Space( 100.0, 100.0 );
The drawLine method takes four double arguments which represent the two endpoints of the line segment. The folliowing call will draw a line between (2.5, 4.3) and (8.6, 20.9):
mySpace.drawLine( 2.5, 4.3, 8.6, 20.9 );
The drawCircle method takes three double arguments which represent the center and the radius of the circle. The following call will draw a circle with the center at (-34.6, 19.2) with radius 5.3:
mySpace.drawCircle( -34.6, 19.2, 5.3)
I will provide everything you need for the Space class in the next day or two.
Wednesday, I will cover the Vector class and how to iterate over all of the elements in a Vector.
I will provide a Particle class after 5pm on Saturday (the last day to turn in the current program).
THE FORUM WOULD NOT LET ME POST A .JAVA PROGRAM SO I COPIED IT TO WORD.
Number of downloads: 129