1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Elena L [17]
3 years ago
14

Import java.util.ArrayList;

Computers and Technology
1 answer:
Nonamiya [84]3 years ago
3 0

Answer:

Explanation:

The following code was fixed but it is impossible to fix the entirety of the code without adjusting the Main method as well. This is because the information is being saved in an ArrayList that is saved within the main method. This means that either we need to move the Arraylist outside of the main method or adjust something inside the main method as well to make the code run. In this iteration, I have added an IF statement to the Point method so that it deletes a point if it is being added for a second time. In order to accomplish this, I had to add an extra argument when calling the Point Method in the Main method which would be the ArrayList in which the information is saved.

import java.util.ArrayList;

import java.util.List;

class PointTest {

   static final class Point {

       private double x, y;

       Point(double x, double y, List<Point> points) {

           this.x = x;

           this.y = y;

           for (int i = 0; i < points.size(); i = i+1) {

               if ((points.get(i).x == x) && (points.get(i).y == y)) {

                   points.remove(i);

               }

           }

       }

   }

   public static void main(final String[] args) {

       List<Point> pointList = new ArrayList<>();

       pointList.add(new Point(1, 2, pointList));

       pointList.add(new Point(3, 4, pointList));

       System.out.println(pointList.size());

// remove the second Point

       pointList.remove(new Point(3, 4, pointList));

       System.out.println(pointList.size());

// REMOVED!!!!!

   }

}

You might be interested in
You're a teacher and you've created a form letter in word that you send to the parents of the students in your class at the begi
Daniel [21]

Answer:

The letter pulls parents' names and addresses, along with the children's names, from an Excel file you get from the main office. To make your form letter word with the updated Excel file, Create a new form letter in Word and use the mail merge feature to link it to the updated Excel file.

Explanation:

7 0
2 years ago
John is considering his STEM education choices. He wants to begin working in the technology field as soon as possible.
wariber [46]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

STEM is a curriculum based on the idea of educating students in four specific disciplines — science, technology, engineering,  and mathematics — in an interdisciplinary and applied approach. The students who graduated in STEM-based education getting more paid and jobs than students who did not study the STEM-based education.

As in this question that John is considering his STEM education choices, and he wants to begin working in the technology field as soon as possible. He should pursue bachelor (graduate) degree in technology. Because after, passing out, he can begin working in technology easily.

5 0
3 years ago
In an agile process, story points are an absolute measurement, which differs from function points, as function points are relati
aleksandrvk [35]

Answer: True

Explanation: In an agile project, the story point are for the determination of the level of difficulty in the implementation of the story. They are accurate and also helps in the further improvement.They also help to reduce the time of plan because of being precise.

Function points work in accordance with the function and depends upon the relative measurements and functional size measurement which makes them less precise.Thus, the given statement is true.

6 0
3 years ago
Given a 13 bit address bus, how many unique addressed could be accessed? g
valina [46]
2^13 = 8192 addresses
8 0
3 years ago
FIGURE A-2—Use the information in this chart to answer Question 2.
Alex777 [14]
The answer is a because that is what is supported
3 0
3 years ago
Other questions:
  • You can choose which rules you want excel to use by enabling and disabling them in the ____ area in the excel options dialog box
    11·1 answer
  • Assume that a gallon of paint covers about 350 square feet of wall space. Create an application with a main() method that prompt
    9·1 answer
  • Who invented autonomous cars? When I look it up it comes up as William Bertelsen but he invented the idea of hovering cars. Help
    8·1 answer
  • A 6.7 kg object moves with a velocity of 8 m/s. What's its kinetic energy?
    6·2 answers
  • I NEED HELP PLEASE ITS TIMED
    9·1 answer
  • What is the best explanation for why digital data is represented in computers in binary?
    10·1 answer
  • WILL GIVE BRAINLIEST
    15·1 answer
  • De que se dio cuenta el sol al participar de la limpieza de playas?
    5·1 answer
  • If you created a variable called name, what data type would that value be?
    7·2 answers
  • The final wrap-up after the conflict is resolved is called the __________________________.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!