public static void Main() { IGeometryUtils geometryUtils = new GeometryUtils(); IFileUtils fileUtils = new FileUtils(); string[] fileNames = { "example", "example.pdf", "example.new.pdf" }; foreach (string fileName in fileNames) { try { Console.WriteLine(fileUtils.GetFileExtension(fileName)); } catch (ArgumentException e) { Console.WriteLine(e.Message); } } foreach (string fileName in fileNames) { try { Console.WriteLine(fileUtils.GetFileNameWithoutExtension(fileName)); } catch (ArgumentException e) { Console.WriteLine(e.Message); } } Point2D firstPoint2D = new Point2D(1, -2); Point2D secondPoint2D = new Point2D(3, 4); Console.WriteLine( "Distance in the 2D space = {0:f2}", geometryUtils.CalcDistance2D(firstPoint2D, secondPoint2D)); Point3D firstPoint3D = new Point3D(5, 2, -1); Point3D secondPoint3D = new Point3D(3, -6, 4); Console.WriteLine( "Distance in the 3D space = {0:f2}", geometryUtils.CalcDistance3D(firstPoint3D, secondPoint3D)); double width = 3; double height = 4; double depth = 5; Volume volume = new Volume(width, height, depth); Console.WriteLine("Volume = {0:f2}", volume.CalcVolume()); Console.WriteLine("Diagonal XYZ = {0:f2}", volume.CalcDiagonalXYZ(geometryUtils)); Console.WriteLine("Diagonal XY = {0:f2}", volume.CalcDiagonalXY(geometryUtils)); Console.WriteLine("Diagonal XZ = {0:f2}", volume.CalcDiagonalXZ(geometryUtils)); Console.WriteLine("Diagonal YZ = {0:f2}", volume.CalcDiagonalYZ(geometryUtils)); }
public static void Main() { string firstFileName = "example"; string secondFileName = "example.pdf"; string thirdFileName = "example.new.pdf"; var firstFileExtenstion = FileNameProcess.GetFileExtension(firstFileName); var secondFileExtenstion = FileNameProcess.GetFileExtension(secondFileName); var thirdFileExtenstion = FileNameProcess.GetFileExtension(thirdFileName); Console.WriteLine(firstFileExtenstion); Console.WriteLine(secondFileExtenstion); Console.WriteLine(thirdFileExtenstion); Distance2D distance2d = new Distance2D(1.0, -2.0, 3.0, 4.0); Distance3D distance3d = new Distance3D(5, 2, -1, 3, -6, 4); Console.WriteLine("Distance in the 2D space = {0:f2}", distance2d.CalculateDistance2D()); Console.WriteLine("Distance in the 3D space = {0:f2}", distance3d.CalculateDistance3D()); Volume volume = new Volume(); volume.Width = 3; volume.Height = 4; volume.Depth = 5; Diagonal2D digonal2d = new Diagonal2D(0, 0, 1, 1); Diagonal3D diagonal3d = new Diagonal3D(0, 0, 0, 1, 1, 1); Console.WriteLine("Volume = {0:f2}", volume.CalcVolume()); Console.WriteLine("Diagonal XYZ = {0:f2}", diagonal3d.CalculateDiagonalXYZ()); Console.WriteLine("Diagonal XY = {0:f2}", digonal2d.CalculateDiagonalXY()); Console.WriteLine("Diagonal XZ = {0:f2}", digonal2d.CalculateDiagonalXZ()); Console.WriteLine("Diagonal YZ = {0:f2}", digonal2d.CalculateDiagonalYZ()); }