CSCI 202 homework 11

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 Point1080 and HomePoint1080 in the edu.unca.cs.csci202 package.

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.

The assignment

Getting started

This assignment builds on Lab 12. Start with the abstract class implementation of Point1080 developed in the lab.

Task one

Create one more extension of Point1080 using either an array of two integers as the representation. Your new class must be called HomePoint1080 and it can contain only one member variable declaration:
    int[] v ;
You must use v to store the x and y co-ordinates of your point.

Task two

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 distance. That is how polymorphism works. You call one as p.distance() and the other as p.distance(q).

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.