Write a complete C# app to prompt the user for the double radius of a sphere, and call method SphereVolume to calculate and display the volume of the sphere. Write an expression-bodied method containing the following expression to calculate the volume:

(4.0 / 3.0) * Math.PI * Math.Pow(radius, 3)


```
// Solution: Sphere.cs
// Calculate the volume of a sphere.
using System;

class Sphere
{
// obtain radius from user and display volume of sphere
static void Main()
{
Console.Write("Enter radius of sphere: ");
double radius = double.Parse(Console.ReadLine());
Console.WriteLine("Volume is {SphereVolume(radius):F3}");
}

// calculate and return sphere volume
static double SphereVolume(double radius) =>
(4.0 / 3.0) * Math.PI * Math.Pow(radius, 3);
}
```

Enter radius of sphere: 4
Volume is 268.083

Computer Science & Information Technology

You might also like to view...

One of the most popular Web browsers today is Microsoft's ________

A) Chrome B) Internet Explorer C) Navigator D) Safari

Computer Science & Information Technology

Based on your analysis, what do you recommend Booker Publishing focus on in terms of their competitive strategy?

What will be an ideal response?

Computer Science & Information Technology

In your opinion, do certain project resources hold a higher importance than other resources? If so, why?

What will be an ideal response?

Computer Science & Information Technology

Each part of a CD-R can be written on multiple times, and the disc's contents can be erased.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology