Advertisement
desislava_topuzakova

Untitled

Apr 12th, 2020
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace demo2
  6. {
  7. class Box
  8. {
  9. //полета
  10. private double width;
  11. private double lenght;
  12. private double height;
  13.  
  14. //методи
  15. public Box (double lenght, double width, double height)
  16. {
  17.  
  18. this.lenght = lenght;
  19. this.width = width;
  20. this.height = height;
  21. }
  22.  
  23. //лице на повърхнина -> 2lw + 2lh + 2wh
  24. public double SurfaceArea()
  25. {
  26. double area = 2 * lenght * width + 2 * lenght * height + 2 * width * height;
  27. return area;
  28. }
  29.  
  30. //Лице на околната повърхнина -> 2lh + 2wh
  31. public double LateralSurfaceArea()
  32. {
  33. double area = 2 * lenght * height + 2 * width * height;
  34. return area;
  35. }
  36.  
  37. //Обем - > l * w * h
  38. public double Volume()
  39. {
  40. double volume = lenght * width * height;
  41. return volume;
  42. }
  43.  
  44. }
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. using System;
  61. using System.Linq;
  62. using System.Reflection;
  63.  
  64. namespace demo2
  65. {
  66. class Program
  67. {
  68. static void Main(string[] args)
  69. {
  70.  
  71.  
  72. double lenght = double.Parse(Console.ReadLine());
  73. double width = double.Parse(Console.ReadLine());
  74. double height = double.Parse(Console.ReadLine());
  75.  
  76. Box box = new Box(lenght, width, height);
  77.  
  78. Console.WriteLine("Surface Area – " + box.SurfaceArea());
  79. Console.WriteLine("Lateral Surface Area – " + box.LateralSurfaceArea());
  80. Console.WriteLine("Volume – " + box.Volume());
  81.  
  82.  
  83.  
  84. }
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement