static void Main(string[] args) { try { decimal length = decimal.Parse(Console.ReadLine()); decimal width = decimal.Parse(Console.ReadLine()); decimal height = decimal.Parse(Console.ReadLine()); Box box = new Box(length, width, height); box.GetArea(length, width, height); box.GetLateralArea(length, width, height); box.Volume(length, width, height); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static void Main(string[] args) { var lenght = double.Parse(Console.ReadLine()); var width = double.Parse(Console.ReadLine()); var height = double.Parse(Console.ReadLine()); try { var box = new Box(lenght, width, height); Console.WriteLine($"Surface Area - {box.GetSurfaceArea():f2}"); Console.WriteLine($"Lateral Surface Area - {box.GetLateralArea():f2}"); Console.WriteLine($"Volume - {box.GetVolume():f2}"); } catch (InvalidOperationException message) { Console.WriteLine(message.Message); } }