Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace demo2
- {
- class Box
- {
- //полета
- private double width;
- private double lenght;
- private double height;
- //методи
- public Box (double lenght, double width, double height)
- {
- this.lenght = lenght;
- this.width = width;
- this.height = height;
- }
- //лице на повърхнина -> 2lw + 2lh + 2wh
- public double SurfaceArea()
- {
- double area = 2 * lenght * width + 2 * lenght * height + 2 * width * height;
- return area;
- }
- //Лице на околната повърхнина -> 2lh + 2wh
- public double LateralSurfaceArea()
- {
- double area = 2 * lenght * height + 2 * width * height;
- return area;
- }
- //Обем - > l * w * h
- public double Volume()
- {
- double volume = lenght * width * height;
- return volume;
- }
- }
- }
- using System;
- using System.Linq;
- using System.Reflection;
- namespace demo2
- {
- class Program
- {
- static void Main(string[] args)
- {
- double lenght = double.Parse(Console.ReadLine());
- double width = double.Parse(Console.ReadLine());
- double height = double.Parse(Console.ReadLine());
- Box box = new Box(lenght, width, height);
- Console.WriteLine("Surface Area – " + box.SurfaceArea());
- Console.WriteLine("Lateral Surface Area – " + box.LateralSurfaceArea());
- Console.WriteLine("Volume – " + box.Volume());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement