Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following static method public static Point highestPoint (List points) Iterator pointIterator- points.iterator); int highest 0; Point highestPoint = null; // TODO use the
Consider the following static method public static Point highestPoint (List points) Iterator pointIterator- points.iterator); int highest 0; Point highestPoint = null; // TODO use the iterator to complete this method! return highestPoint; You are required to complete the static method. The static method contains an iterator of an ArrayList of Point objects. You should use a loop and the pointIterator to check the point with the largest Y value. Returns the point with the largest Y value Insert statements in the answer box below For example Test Result List points new LinkedList() java.awt.Point[x-3,y-8] points.add(new Point (1, 1)); points.add (new Point (1, 3)); points.add(new Point (3, 1)); points.add(new Point(3, 8)); System.out.println(highestPoint(points)); Answer (penalty regime: 0 %) 1 public static Point highestPoint(List points) 2 Iterator pointIterator points.iterator(); int highest e; 4 Point highestPointnull; 5// TODO use the iterator to complete this method! 7 8 return highestPoint; 9
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started