Advertisement
Guest User

Class Paralelepiped

a guest
Apr 9th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | Source Code | 0 0
  1.  
  2. using System;
  3.  
  4. namespace class1
  5. {
  6.  
  7.     public class Paralelepiped
  8.     {
  9.         public double Width { get; set; }
  10.         public double Length { get; set; }
  11.         public double Height { get; set; }
  12.        
  13.        
  14.         public Paralelepiped(double width, double length, double height)
  15.         {
  16.             this.Width = width;
  17.             this.Length = length;
  18.             this.Height = height;          
  19.         }
  20.        
  21.        
  22.         public double Volume()
  23.         {
  24.             return Width * Length * Height;
  25.         }
  26.        
  27.        
  28.         public double SideArea()
  29.         {
  30.             return (Width * 2 + Length * 2) * Height;
  31.         }
  32.        
  33.        
  34.         public double FullArea()
  35.         {
  36.             return (Width * 2 + Length * 2) * Height + Width * Length * 2;
  37.         }
  38.        
  39.        
  40.         public override string ToString()
  41.         {
  42.             return string.Format("size: {0}x{1}x{2}, V={3}, S={4}, S1={5}",
  43.                          Width, Length, Height, Volume(), SideArea(), FullArea());
  44.         }
  45.  
  46.     }
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement