static decimal pi = 3.14159M;
static private decimal SAofCone(decimal r, decimal h)
double r2 = (double)r * (double)r;
double h2 = (double)h * (double)h;
double slant = Math.Sqrt(r2 + h2);
return pi * r * r + pi * r * (decimal)slant;
static private decimal SAofCyl(decimal r, decimal h)
return (2 * pi * r * r) + (2 * pi * r * h);
static private decimal SAofSph(decimal r)
public static void Main()
string restart = "It's not what's on the surface that matters...It's what's on the inside that truly counts.";
while (restart != "q" && restart != "Q")
Console.WriteLine("-----------------------------");
Console.WriteLine(" ~ SURFACE AREA CALCULATOR ~ ");
Console.WriteLine("-----------------------------");
Console.WriteLine("Welcome to Joe's Surface Area Calculator. Please choose which option you would like to calculate:");
Console.WriteLine("Press 1 to calculate the surface area of a cone.");
Console.WriteLine("Press 2 to calculate the surface area of a cylinder.");
Console.WriteLine("Press 3 to calculate the surface area of a sphere.");
string choice = Console.ReadLine();
Console.WriteLine("------------------");
Console.WriteLine(" ~ SA of a Cone ~ ");
Console.WriteLine("------------------");
Console.WriteLine("What is the radius of the cone?");
decimal radius = decimal.Parse(Console.ReadLine());
Console.WriteLine("What is the height of the cone?");
decimal height = decimal.Parse(Console.ReadLine());
Console.WriteLine("The surface area of the cone is " + SAofCone(radius, height).ToString("##.###") + ".");
Console.WriteLine("----------------------");
Console.WriteLine(" ~ SA of a Cylinder ~ ");
Console.WriteLine("----------------------");
Console.WriteLine("What is the radius of the cylinder?");
decimal radius2 = decimal.Parse(Console.ReadLine());
Console.WriteLine("What is the height of the cylinder?");
decimal height2 = decimal.Parse(Console.ReadLine());
Console.WriteLine("The surface area of the cone is " + SAofCyl(radius2, height2).ToString("##.###") + ".");
Console.WriteLine("--------------------");
Console.WriteLine(" ~ SA of a Sphere ~ ");
Console.WriteLine("--------------------");
Console.WriteLine("What is the radius of the sphere?");
decimal radius3 = decimal.Parse(Console.ReadLine());
Console.WriteLine("The surface area of the cone is " + SAofSph(radius3).ToString("##.###") + ".");
Console.WriteLine("Press q to quit or any other key to continue.");
restart = Console.ReadLine();