Computer Science, asked by Toqeer64, 8 months ago

Question 6 The method getNumPoints returns the number of points in a Shape s Question 6 The method getNumPoints returns the number of points in a Shape s

Answers

Answered by heenakhanA
12

Answer:

The method getNumPoints returns the number of points in a Shape s.

Which one of the following is NOT a correct implementation of getNumPoints?

a,public int getNumPoints (Shape s) {

int count = 0;

for (Point p : s.getPoints()) {

int newPoint = 1;

count = count + newPoint;

}

return count;

}

b, public int getNumPoints (Shape s) {

int count = 0;

for (Point p : s.getPoints()) {

count = count + count;

}

return count;

}

c,public int getNumPoints (Shape s) {

int count = 0;

int newPoint = 1;

for (Point p : s.getPoints()) {

count = count + newPoint;

}

return count;

}

d, public int getNumPoints (Shape s) {

int count = 0;

for (Point p : s.getPoints()) {

count = count + 1;

}

return count;

}

Explanation:

mark me as a brainliest

Similar questions