Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

JAVA

Xenon
Xenon 


(60 points) Enhance the mouse event program I worked on to calculate the sum of distances between the points (point 0 to point 1, point 1 to point 2,..., point N-2 to point N-1) where N is the number of points in the array list. Connect all neighboring points with a white line. You would do this each time you introduce a new point. (10 points) Draw the longest edge between the two points in green. (10 points) Draw the shortest edge between the two points in red. (20 points) Label the distances between each pair of points in the middle of the line (approximately). You have to compute the (approximate) location, not hardcode it. Attachments Tags
Clarifications

Answers

Java - Solution

mariobeka
mariobeka 



Below you will find a half solution of your problem. I was not able to understand what you meant by draw the longest/shortest edge between the two points. Attachments
PointCount.java (1 K) Download Preview
and open the template in the editor. */ /** * * @author mtrutsch */ public class PointCount extends Point { private int count = 0; public PointCount() { }

DotsPanel.java (3 K) Download Preview
// -------------------------------------------------------------- // Adds the current point to the list of points and redraws // the panel whenever the mouse button is pressed. // -------------------------------------------------------------- @Override public void mouseClicked(MouseEvent e) { boolean spotSelected = false; int count = 0; while (count < pointList.size() && !spotSelected) { Point current = pointList.get(count).getPoint();

Dots.java (1 K) Download Preview
Dots { // ----------------------------------------------------------------- // Creates and displays the application frame.

Screen Shot 2016-03-13 at 07.51.41.png (37 K) Download Preview

Screenshots
Screenshot
Purchase Answer