static void Main(string[] args) { Type boxType = typeof(Box); FieldInfo[] fields = boxType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance); Console.WriteLine(fields.Count()); double lenght = double.Parse(Console.ReadLine()); double width = double.Parse(Console.ReadLine()); double height = double.Parse(Console.ReadLine()); try { Box box = new Box(lenght, width, height); var lateralsurface = Box.LateralSurface(box.Lenght, box.Width, box.Height); var surface = Box.SurfaceAres(box.Lenght, box.Width, box.Height); var volume = Box.Volume(box.Lenght, box.Width, box.Height); Console.WriteLine($"Surface Area - {surface:F2}"); Console.WriteLine($"Lateral Surface Area - {lateralsurface:F2}"); Console.WriteLine($"Volume - {volume:F2}"); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } }
public static void Main() { Type boxType = typeof(Box); FieldInfo[] fields = boxType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance); Console.WriteLine(fields.Count()); var length = double.Parse(Console.ReadLine()); var width = double.Parse(Console.ReadLine()); var height = double.Parse(Console.ReadLine()); var box = new Box(length, width, height); Console.WriteLine($"Surface Area - {box.SurfaceArea():f2}"); Console.WriteLine($"Lateral Surface Area - {box.LateralSurface():f2}"); Console.WriteLine($"Volume - {box.Volume():f2}"); }
static void Main(string[] args) { try { double lenght = double.Parse(Console.ReadLine()); double width = double.Parse(Console.ReadLine()); double height = double.Parse(Console.ReadLine()); var box = new Box(lenght, width, height); var volume = box.Volume(lenght, height, width); var surfaceArea = box.Surface(lenght, height, width); var lateralSurfaceArea = box.LateralSurface(lenght, height, width); Console.WriteLine($"Surface Area - {surfaceArea:F2}"); Console.WriteLine($"Lateral SurfaceArea - {lateralSurfaceArea:F2}"); Console.WriteLine($"Volume - {volume:F2}"); } catch (ArgumentException argEx) { Console.WriteLine(argEx.Message); } }
public static void Main(string[] args) { var lenght = double.Parse(Console.ReadLine()); var width = double.Parse(Console.ReadLine()); var height = double.Parse(Console.ReadLine()); // try { Box box = new Box(lenght, width, height); var surfaceArea = box.SurfaceArea(); var surfaceLateral = box.LateralSurface(); var volume = box.Volume(); Console.WriteLine($"Surface Area - {surfaceArea:f2}"); Console.WriteLine($"Lateral Surface Area - {surfaceLateral:f2}"); Console.WriteLine($"Volume - {volume:f2}"); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } }