public abstract class Solid
{
private String name;
//constructor
public Solid(String solidName)
{ name = solidName; }
public String getName()
{ return name; }
public abstract double volume();
}
public class Sphere : Solid
{
private double radius;
//constructor
public Sphere(String sphereName, double sphereRadius) : base(sphereName)
{
radius = sphereRadius;
}
public override double volume()
{ return (4.0/3.0) * Math.PI * radius * radius * radius; }
}
public class RectangularPrism : Solid
{
private double length;
private double width;
private double height;
//constructor
public RectangularPrism(String prismName, double l, double w, double h) : base(prismName)
{
length = l;
width = w;
height = h;
}
public override double volume()
{ return length * width * height; }
}
A program that tests these classes has the following declarations and assignments:
Solid s1, s2, s3, s4;
s1 = new Solid("blob");
s2 = new Sphere("sphere", 3.8);
s3 = new RectangularPrism("box", 2, 4, 6.5);
s4 = null;
How many of the above lines of code are incorrect?
(A) 0
(B) 1
(C) 2
(D) 3
(E) 4