Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I already have question 4 answered. Please give me the solution for question 5.

ID: 3807112 • Letter: I

Question

I already have question 4 answered. Please give me the solution for question 5. Thanks.

4. code for a class, Location, to store the row and column of an artifact in the grid. The maximum of the grid should be 500x500. The class should include the following methods: size Location Default constructor initializes to location (0,0). Location (int r, int c) Constructor to create a location with row r and column c. int get Row int methods which return the row and column and getool-Getter of the location. void set Row (int ry and void setool (int c) Setter methods which modify the row and column of the location. (These should also make sure that the new location is within the maximum grid size) boolean equals (Location o) Comparison method which returns true if two locations have the same row and column.

Explanation / Answer

This can't be done without full question. Question 4 just descive how location looks like it doesn't inidcate how they are mapped to artifact and how artifact are storred in program or what artifact is. Here is code structure which will solve your problem but it can't be made to work unless we have details mentioned.

List getArtifactsLocation(int n)

{

List l = new ArrayList();

Map m = new HashMap();

for (Location L: locationList)

{

if (m.get(location)) m.put(location, m.get(location+1));

else m.put(location, 1);

}

for(entry: m)

{

if(entry.value() >= n)

l.add(entry.key())

}

return l;

}