Advertisement
Guest User

Box - StartUp

a guest
Jul 10th, 2020
801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2.  
  3. namespace P01.ClassBoxData
  4. {
  5.     public class Program
  6.     {
  7.         public static void Main()
  8.         {
  9.             double length = double.Parse(Console.ReadLine());
  10.             double width = double.Parse(Console.ReadLine());
  11.             double height = double.Parse(Console.ReadLine());
  12.  
  13.             Box box = null;
  14.             try
  15.             {
  16.                 box = new Box(length, width, height);
  17.                
  18.             }
  19.             catch (ArgumentException ae)
  20.             {
  21.  
  22.                 Console.WriteLine(ae.Message);
  23.                 return;
  24.             }
  25.             Console.WriteLine($"Surface Area - {box.SurfaceArea():f2}");
  26.             Console.WriteLine($"Lateral Surface Area - {box.LateralSurfaceArea():f2}");
  27.             Console.WriteLine($"Volume - {box.Volume():f2}");
  28.  
  29.  
  30.  
  31.  
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement