static void Main(string[] args) { double[] tokens = new double[3]; for (int i = 0; i < 3; i++) { double currentData = double.Parse(Console.ReadLine()); tokens[i] = currentData; } double length = tokens[0]; double width = tokens[1]; double height = tokens[2]; Box box = null; try { box = new Box(length, width, height); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); return; } Console.WriteLine($"Surface Area - {box.SurfaceArea():f2}"); Console.WriteLine($"Lateral Surface Area - {box.LateralSurfaceArea():f2}"); Console.WriteLine($"Volume - {box.Volume():f2}"); }
static void Main(string[] args) { Box box = Box.CreateBox(); if (box.ValidateData()) { Console.WriteLine($"Surface Area - {box.SurfaceArea():F2}"); Console.WriteLine($"Lateral Surface Area - {box.LateralSurfaceArea():F2}"); Console.WriteLine($"Volume - {box.Volume():F2}"); } Console.ReadLine(); }
public static void Main() { 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.LateralSurfaceArea():f2}"); Console.WriteLine($"Volume - {box.Volume():f2}"); }
static void Main(string[] args) { double length = double.Parse(Console.ReadLine()); double width = double.Parse(Console.ReadLine()); double height = double.Parse(Console.ReadLine()); Box box = new Box(length, width, height); Console.WriteLine($"Surface Area - {box.SurfaceArea():F2}"); Console.WriteLine($"Lateral Surface Area - {box.LateralSurfaceArea():F2}"); Console.WriteLine($"Volume - {box.Volume():F2}"); }
static void Main(string[] args) { double length = double.Parse(Console.ReadLine()); double width = double.Parse(Console.ReadLine()); double height = double.Parse(Console.ReadLine()); Box box = new Box(length, width, height); box.SurfaceArea(length, width, height); box.LateralSurfaceArea(length, width, height); box.Volume(length, width, height); }
static void Main(string[] args) { var length = double.Parse(Console.ReadLine()); var width = double.Parse(Console.ReadLine()); var heigth = double.Parse(Console.ReadLine()); Box box = new Box(length, width, heigth); Console.WriteLine(box.SurfaceArea()); Console.WriteLine(box.LateralSurfaceArea()); Console.WriteLine(box.VolumeArea()); }
static void Main(string[] args) { double length = double.Parse(Console.ReadLine()); double width = double.Parse(Console.ReadLine()); double height = double.Parse(Console.ReadLine()); Box box = new Box(length, width, height); if (length > 0 && width > 0 && height > 0) { Console.WriteLine("Surface Area - {0:F2}", box.SurfaceArea()); Console.WriteLine("Lateral Surface Area - {0:F2}", box.LateralSurfaceArea()); Console.WriteLine("Volume - {0:F2}", box.Volume()); } }
static void Main(string[] args) { double length = double.Parse(Console.ReadLine()); double width = double.Parse(Console.ReadLine()); double height = double.Parse(Console.ReadLine()); Box myBox = new Box(length, width, height); var volume = myBox.Volume(); var surfaceArea = myBox.SurfaceArea(); var lateralArea = myBox.LateralSurfaceArea(); Console.WriteLine($"Surface Area - {surfaceArea:f2}"); Console.WriteLine($"Lateral Surface Area - {lateralArea:f2}"); Console.WriteLine($"Volume - {volume:f2}"); }
static void Main(string[] args) { var box = new Box(); box.Length = double.Parse(Console.ReadLine()); box.Width = double.Parse(Console.ReadLine()); box.Height = double.Parse(Console.ReadLine()); Type boxType = typeof(Box); FieldInfo[] fields = boxType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance); Console.WriteLine(fields.Count()); Box.SurfaceArea(box); Box.LateralSurfaceArea(box); Box.Volume(box); }
public static void Main() { 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); Console.WriteLine(box.SurfaceArea()); Console.WriteLine(box.LateralSurfaceArea()); Console.WriteLine(box.Volume()); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void Main() { try { 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 - {0:F2}", box.SurfaceArea()); Console.WriteLine("Lateral Surface Area - {0:F2}", box.LateralSurfaceArea()); Console.WriteLine("Volume - {0:F2}", box.Volume()); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } }