subject

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

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 00:00, ajwiebel3475
Which requirement is an appropriate reason for a business to use it tools
Answers: 3
image
Computers and Technology, 22.06.2019 15:00, miracle9704
Atool that matches persoal skills qualities interests and talets to a career is called a
Answers: 1
image
Computers and Technology, 23.06.2019 22:30, kayelynn003
How many points do i need before i can send a chat
Answers: 1
image
Computers and Technology, 24.06.2019 01:30, BIKRAMlawati5544
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
You know the right answer?
Consider the following abstract class declaration.

public abstract class 2DShape
...

Questions in other subjects:

Konu
Biology, 09.04.2021 22:00
Konu
Mathematics, 09.04.2021 22:00
Konu
Spanish, 09.04.2021 22:00