public static void Main(string[] args) { double length = double.Parse(Console.ReadLine()); double width = double.Parse(Console.ReadLine()); double height = double.Parse(Console.ReadLine()); try { Box box = new Box(length, width, height); Console.WriteLine(box.CalculateSurfaceArea()); Console.WriteLine(box.CalculateLateralSurface()); Console.WriteLine(box.CalculateVolume()); } catch (Exception ex) { } }
static void Main(string[] args) { double length = double.Parse(Console.ReadLine()); double width = double.Parse(Console.ReadLine()); double height = double.Parse(Console.ReadLine()); try { var box = new Box(length, width, height); Console.WriteLine($"Surface Area - {box.CalculateSurface():f2}"); Console.WriteLine($"Lateral Surface Area - {box.CalculateLateralSurface():f2}"); Console.WriteLine($"Volume - {box.CalculateVolume():f2}"); } catch (ArgumentException ae) { Console.WriteLine(ae.Message); } }
public static void Main() { try { double lenght = double.Parse(Console.ReadLine()); double width = double.Parse(Console.ReadLine()); double height = double.Parse(Console.ReadLine()); Box box = new Box(lenght, width, height); Console.WriteLine($"Surface Area - {box.CalculateSurfaceArea():F2}"); Console.WriteLine($"Lateral Surface Area - {box.CalculateLateralSurfaceArea():F2}"); Console.WriteLine($"Volume - {box.CalculateVolume():F2}"); } catch (ArgumentException exeption) { Console.WriteLine(exeption.Message); } }
static void Main(string[] args) { double boxLength = double.Parse(Console.ReadLine()); double boxWidth = double.Parse(Console.ReadLine()); double boxHeight = double.Parse(Console.ReadLine()); try { var box = new Box(boxLength, boxWidth, boxHeight); Console.WriteLine($"Surface Area - {box.CalculateSurfaceArea():F2}"); Console.WriteLine($"Lateral Surface Area - {box.CalculateLateralSurfaceArea():F2}"); Console.WriteLine($"Volume - {box.CalculateVolume():F2}"); } catch (Exception ae) { Console.WriteLine(ae.Message); } }
static void Main(string[] args) { double length = double.Parse(Console.ReadLine()); double width = double.Parse(Console.ReadLine()); double height = double.Parse(Console.ReadLine()); //this way we show only the message of the error try { Box box = new Box(length, width, height); Console.WriteLine($"Surface Area - {box.CalculateSurfaceArea():f2}"); Console.WriteLine($"Lateral Surface Area - {box.CalculateLatercalSurfaceArea():f2}"); Console.WriteLine($"Volume - {box.CalculateVolume():f2}"); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } }
static void Main(string[] args) { decimal length = decimal.Parse(Console.ReadLine()); decimal width = decimal.Parse(Console.ReadLine()); decimal height = decimal.Parse(Console.ReadLine()); try { var box = new Box(length, width, height); Console.WriteLine($"Surface Area - {box.CalculateSurfaceArea():f2}"); Console.WriteLine($"Lateral Surface Area - {box.CalculateLeteralArea():f2}"); Console.WriteLine($"Volume - {box.CalculateVolume():f2}"); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } }