Due: Tuesday 3/18 10:00am
Submission name: w11_orbnodes
We will continue with the work started in class on using a node based Orb
structure.
-
Start with the program developed in class.
OrbNode
should also have the following methodsvoid display(int springLength)
- Display the
OrbNode
. - If there is a
next
node, draw a line betweenthis
and thenext
OrbNode
objects. - If there is a
previous
node, draw a line betweenthis
and thenext
OrbNode
objects.- Move the endpoints for each of these lines a little bit so the lines dont directly overlap each other.
- Make the color of the line related to the state of the spring (extended, compressed, neither).
- Display the
void applySprings(int springLength, float springK)
- Apply the spring force between the calling Orb and it’s
next
andprevious
neighbors when applicable.
- Apply the spring force between the calling Orb and it’s
- Write a driver file that creates at least 3
OrbNodes
and connects them. Then indraw
- Use a
while
loop to display eachOrbNode
- Use a
while
loop to callapplySprings
on eachOrbNode
- Use a
while
loop to callrun
on eachOrbNode
- These loops should not be integer-counter based.
- Use a