Question: Exercise 2: Arrays of Objects Consider the Point and Line classes that are represented by the following UML. Assume you have an array that stores

 Exercise 2: Arrays of Objects Consider the Point and Line classesthat are represented by the following UML. Assume you have an arraythat stores references to 500 Line objects. Point -x: double -v: double

Exercise 2: Arrays of Objects Consider the Point and Line classes that are represented by the following UML. Assume you have an array that stores references to 500 Line objects. Point -x: double -v: double +Point +Point(xdouble y.double) +getX():double +getY():double +setX(x.double):void + setY(y double):void eng-String boolean Line -start:Point |-end:Point +Line(xStart:double, yStart:double, xEnd:double, yEnd:double) +getStart():Point *getEnd:Point setStart(start:Point):void +setEnd(end:Point)vold +length():double midPoint Point 1 Metropolitan State University Department of Computer Science and Cybersecurity ICS 240-50 Spring 2022 Write Java code to do the following: 1- Print the start and end points for the line with the maximum length. 2- Check whether the array contains a line that starts or ends at point (0,0). Exercise 1: Arrays of Primitives Consider the following array of integers: int scores[] {10, 40, -10, 50, 70, 65, 54, 23, 82 }; Write Java code to do the following: 1- Find how many even numbers and how many odd numbers are there in the array. 2- Check whether the array contains the arbitrary value x. AutoSave OF AAOO... Home Insert Draw Design Layout References Mailings Review week-02-worksheet View Tell me AEE21 Anblwedd AaBbcc AabbCet AaBbcec AaBbce! C Share Comments Times New... v 14 ~ A Aav B ! | y de x x BU AO Pagic == Normal Til Sulite Author Hela 1 Dictate Styles Pante Sensitivity $ Editer Exercise 3: Using IntArrayBag Consider the IntArrayBag collection class that we discussed in class, Draw the data array after executing the following code and show the values that are stored in each cell of the array. Show the array four times at the points labelled A, B, C, and D IntArrayBag bagl = new IntArrayBag (5); bagl.add (10); bagl.add (5); bagl.add (20); bagl.add (13); // Point A bagl.remove (5); // Point B bagl.add(8); bagl.remove (10); // Point C bagl.add(30); // Point D Exercise 4: search method in IntArrayBag Write a method belonging to the IntArrayBag class that searches for a target number. When found, return its index. If not found, return -1. Make sure to include the method header Page 2 of 2 318 words LE English (United States) Focus + 158%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!