using System.Collections.Generic;
using System.Threading.Tasks;
namespace Independent_Project
public static void Main()
Console.WriteLine("Welcome to caculate the volume!");
Console.WriteLine("Choose a shape to caculate the volume");
Console.WriteLine("1: rectangular prism");
Console.WriteLine("2: cone");
Console.WriteLine("3: cylinder");
Console.WriteLine("4: sphere");
Console.WriteLine("0: exit program");
bool sucess = int.TryParse(Console.ReadLine(), out x);
Console.WriteLine("Enter 1 if values are integers, and enter 2 if values are decimals: ");
string mode = Console.ReadLine();
Console.Write("Enter value for length of prism: ");
bool work = int.TryParse(Console.ReadLine(), out int length);
Console.Write("Please enter a valid integer length: ");
work = int.TryParse(Console.ReadLine(),out length);
Console.Write("Enter value for height of prism: ");
bool work1 = int.TryParse(Console.ReadLine(), out int height);
Console.Write("Please enter a valid integer height: ");
work1 = int.TryParse(Console.ReadLine(), out height);
Console.Write("Enter value for width of prism: ");
bool work2 = int.TryParse(Console.ReadLine(), out int width);
Console.Write("Please enter a valid integer width: ");
work2 = int.TryParse(Console.ReadLine(), out width);
CalculateR(length, height, width);
Console.Write("Enter value for length of prism: ");
bool work = double.TryParse(Console.ReadLine(), out double length);
Console.Write("Please enter a valid double for length: ");
work = double.TryParse(Console.ReadLine(), out length);
Console.Write("Enter value for height of prism: ");
bool work1 = double.TryParse(Console.ReadLine(), out double height);
Console.Write("Please enter a valid double for height: ");
work1 = double.TryParse(Console.ReadLine(), out height);
Console.Write("Enter value for width of prism: ");
bool work2 = double.TryParse(Console.ReadLine(), out double width);
Console.Write("Please enter a valid double for width: ");
work2 = double.TryParse(Console.ReadLine(), out width);
CalculateR(length, height, width);
Console.WriteLine("Please enter a valid input next time!");
Console.Write("Enter value for radius of cone: ");
bool work = double.TryParse(Console.ReadLine(), out double radius);
Console.Write("Please enter a valid double for radius: ");
work = double.TryParse(Console.ReadLine(), out radius);
Console.Write("Enter value for height of cone: ");
bool work1 = double.TryParse(Console.ReadLine(), out double height);
Console.Write("Please enter a valid double for height: ");
work1 = double.TryParse(Console.ReadLine(), out height);
CalculateCo(radius, height);
Console.Write("Enter value for radius of cylinder: ");
bool work = double.TryParse(Console.ReadLine(), out double radius);
Console.Write("Please enter a valid double for radius: ");
work = double.TryParse(Console.ReadLine(), out radius);
Console.Write("Enter value for height of cylinder: ");
bool work1 = double.TryParse(Console.ReadLine(), out double height);
Console.Write("Please enter a valid double for height: ");
work1 = double.TryParse(Console.ReadLine(), out height);
CalculateCy(radius, h:height);
Console.Write("Enter value for radius of shpere: ");
bool work = double.TryParse(Console.ReadLine(), out double radius);
Console.Write("Please enter a valid double for radius: ");
work = double.TryParse(Console.ReadLine(), out radius);
public static void CalculateR(int l = 1, int h = 1, int w = 1)
Console.WriteLine($"Length is {l}");
Console.WriteLine($"Height is {h}");
Console.WriteLine($"Width is {w}");
Console.WriteLine($"Volume is {vol}");
public static void CalculateR(double l = 1, double h = 1, double w = 1)
Console.WriteLine($"Length is {l}");
Console.WriteLine($"Height is {h}");
Console.WriteLine($"Width is {w}");
Console.WriteLine($"Volume is {Math.Round(vol, 2)}");
public static void CalculateCo(double r = 1, double h = 1)
double vol = 0.33333 * 3.14159265 * (r * r) * h;
Console.WriteLine($"Radius is {r}");
Console.WriteLine($"Height is {h}");
Console.WriteLine($"Volume is {Math.Round(vol, 2)}");
public static void CalculateCy(double r = 1,double pi = 3.14159265, double h = 1)
double vol = pi * (r * r) * h;
Console.WriteLine($"Radius is {r}");
Console.WriteLine($"Height is {h}");
Console.WriteLine($"Volume is {Math.Round(vol, 2)}");
public static void CalculateS(double r = 1)
double vol = (r * r * r);
Console.WriteLine($"Radius is {r}");
Console.WriteLine($"Volume is {Math.Round(vol, 2)}");
public static void ModifyV(ref double value)
value = 1.33333333333 * 3.14159265 * value;