{ static decimal pi = 3.14159M;
static private decimal SAofCone(decimal r, decimal h)
return pi * r2 + pi * r * h;
static private decimal SAofCylinder(decimal r, decimal h)
return 2 * pi * r * h + 2 * pi * r2;
static private decimal SAofSphere(decimal r)
static private decimal VCON(decimal r, decimal h)
return (1M / 3M) * pi * r2* h;
static private decimal VSPH(decimal r)
return (4M / 3M) * pi * r3;
static private decimal VCYL(decimal r, decimal h)
public static void Main()
while (restart != "q" && restart != "Q") {
Console.WriteLine("Press 1 to calculate the surface area/volume of a cone, 2 to calculate the surface area/volume of a cylinder, and 3 to calculate the surface area/volume of a sphere.");
string choice = Console.ReadLine();
{Console.WriteLine("Please Enter the radius and then the height of your cone.");
decimal radius = decimal.Parse(Console.ReadLine());
decimal height = decimal.Parse(Console.ReadLine());
Console.WriteLine("The surface area of your cone is: " + SAofCone(radius,height).ToString("##.##"));
Console.WriteLine("The volume of your cone is: " + VCON(radius,height).ToString("##.##"));
{Console.WriteLine("Please Enter the radius of your circle and the height of your cylinder.");
decimal radius = decimal.Parse(Console.ReadLine());
decimal height = decimal.Parse(Console.ReadLine());
Console.WriteLine("The surface area of your cylinder is: " + SAofCylinder(radius,height).ToString("##.##"));
Console.WriteLine("The volume of your cylinder is: " + VCYL(radius,height).ToString("##.##"));
{Console.WriteLine("Please Enter the radius of your sphere.");
decimal radius = decimal.Parse(Console.ReadLine());
Console.WriteLine("The surface area of your sphere is: " + SAofSphere(radius).ToString("##.##"));
Console.WriteLine("The volume of your sphere is: " + VSPH(radius).ToString("##.##"));
Console.WriteLine("Please enter a valid option");
Console.WriteLine("Press q to quit or anything else to restart.");
restart = Console.ReadLine();