Consider the following abstract class declaration.
public abstract class 2DShape
...
Computers and Technology, 05.03.2020 02:58 sandersasia2
Consider the following abstract class declaration.
public abstract class 2DShape
{
abstract public double getArea();
public String toString()
{ return A shape with area getArea(); }
}
Which of the following class declarations correctly extend the abstract class 2DShape?
I.
public class Circle extends 2DShape
{
double r;
// constructors not shown
public double getArea()
{ return 3.14 * r * r; }
public String toString()
{ return "A circle with radius " + r; }
}
II.
public class Triangle extends 2DShape
{
double b;
double h;
// constructors not shown
public double getArea()
{ return b * h / 2; }
}
III.
public class Polygon extends 2DShape
{
int numSides;
// constructors not shown
public int getArea()
{ return numSides; }
public String toString()
{ return "A polygon with " + numSides + " sides."; }
}
A. I, II and III
B. I and II only
C. II only
D. I and III only
E. I only
Answers: 2
Computers and Technology, 22.06.2019 15:20
This os integrated the processing power of windows nt with the easy-to-use gui of windows 98. windows 2000 windows 3.11 windows for workgroups windowa millennium edition
Answers: 1
Computers and Technology, 23.06.2019 22:30
What would be the address of the cell, which is at the intersection of the second row and the third column in a worksheet?
Answers: 1
Computers and Technology, 24.06.2019 11:20
Colby works as a shipping clerk for a major package delivery service. some of his daily tasks include tracking shipments and entering orders. which aspect of the information technology cluster would he most likely be trained in? a.networkingb.databasesc.hardwared.software
Answers: 2
Computers and Technology, 25.06.2019 08:00
The heart of a computer.basic input/output systemselectmain memoryserial portcentral processing unit (cpu)
Answers: 3
Mathematics, 16.12.2020 21:30
History, 16.12.2020 21:40
Mathematics, 16.12.2020 21:40
Mathematics, 16.12.2020 21:40
History, 16.12.2020 21:40
Mathematics, 16.12.2020 21:40
Social Studies, 16.12.2020 21:40
Mathematics, 16.12.2020 21:40
Mathematics, 16.12.2020 21:40