Rules of submission
This assignment must be submitted to the Moodle submission page for Homework 11 by 11:00 PM on Monday, 15 April.
Your submission must contain two classes
HomePoint1080 in the
A word on attribution
I do understand that students work together in the lab. Attibution is not a significant issue in the lab because the lab is graded more on effort rather than on results.
However, if someone helps you in the lab and that help is incorporated in a turned-in assignment, you must give credit to that person.
Also, the additional work required to transform a lab assignment into a homework assignment should be the result of your individual effort.
This assignment builds on Lab 12.
Start with the
Point1080 developed in the lab.
Create one more extension of
either an array of two integers as the representation.
Your new class must be called
and it can contain only one member variable
int v ;
You must use
v to store the x and
y co-ordinates of your point.
Add an additional method called
distance to the
Point1080 class to implement the distance between
two points. The signature of this method should be
public double distance(Point1080 p) ;
There is nothing wrong with having two methods called
That is how polymorphism works. You call one as
p.distance() and the other as
If you can’t remember the distance between two points, check out Wolfram MathWorld.
If all is working well, both of the following calls should return a value close to 500.
(new HomePoint1080(300,400)).distance(new HomePoint1080(700,700))