Thu Sep 15, Mon Sep 19, and Tue Sep 20
Due date:
ALL SECTIONS: Tue Oct 4 before 23:59
The goals of this lab are to:
static
methods
This lab assumes that you are familiar with 2-dimensional spatial vectors. If you are not familiar with the basic mathematical operations that can be performed using vectors you should review the material found in this tutorial.
To get started, you should do the following in eclipse:
eecs2030.lab2
eecs2030.lab2
create a new Java class named
Vector2
. Replace the automatically created
contents of Vector2
with the contents of this file. Use cut-and-paste, don't try typing it all in!
Vector2.java
in the Package Explorer on the left-hand
side of the eclipse IDE, and selecting New -> JUnit test case. A
dialog window will appear with the title New JUnit Test Case; the
name of the test case should be Vector2Test
. Click
the Finish button.
Vector2Test
with the contents of this file. Use cut-and-paste, don't try typing it all in!
Vector2
.
Recall that the API for a class typically shows all of the public
features of a class. You should see that Vector2
has
three constructors, four static
methods, and thirteen non-static
methods. Make sure that you understand the API for each method.
Vector2
, add the three constructors. Recall that
the job of a constructor is to set the values of the fields of the object
that is being constructed. In this case, your constructors should set the
values of this.x
and this.y
; this task
is very similar to the task you completed last week for the
Point2
class.
The Koch snowflake is an example of a fractal curve; the shape of the curve appears the same no matter how far you zoom in on the curve. Wikipedia page presents a concise description of the Koch snowflake with some interesting illustrations of the snowflake and related curves.
The Vector2
class can be used by a second class (which you
might implement in a future lab) to draw an approximation of the
Koch snowflake (actually six overlapping snowflakes).
Project
menuProperties
Java Build Path
Libraries
tabAdd External JARs...
buttonKochSnowflake
to the eecs2030.lab2
package. Replace the automatically created
contents of KochSnowflake
with the contents of this file.
If you are not working in a group, submit your solution using the submit
command. Remember that
you first need to find your workspace directory, then you need to find
your project directory. In your project directory, your files will be
located in the directory src/eecs2030/lab1
submit 2030 lab2 Vector2.java
If you are working in a group, create a plain text file named
group.txt
. You can do this in eclipse using the menu
File -> New -> File. Type your login names into the file
with each login name on its own line. For example, if the students
with login names
rey
, finn
, and dameronp
,
worked in a group the contents of group.txt
would
be:
rey finn dameronp
Submit your solution using the submit
command. Remember that
you first need to find your workspace directory, then you need to find
your project directory. In your project directory, your files will be
located in the directory src/eecs2030/lab1
submit 2030 lab2 Vector2.java group.txt
The process for submitting from outside of the Prism lab involves the following steps:
Windows users will likely need to install additional software first. Mac users have all of the required software as part of MacOS.