Wednesday, September 11, 2024

**Problem:**

The surface area of a cone is given by the formula

where *r* refers to the radius of the base and *h* refers to the vertical height of the cone, as shown.

Which Java instruction will correctly calculate the surface area of a cone?

`double cone_area = Math.PI * r * r + Math.sqrt(h * h + r * r);`

`double cone_area = Math.PI * r * r + Math.sqrt(h * h) + Math.sqrt(r * r);`

`double cone_area = Math.PI * r * (r + Math.sqrt(h * h + r * r));`

`double cone_area = Math.PI * r * (r + Math.sqrt(h * h) + Math.sqrt(r * r));`

See the solution here.

]]>