rendered paste bodyusing System;
using System.Collections.Generic;
using System.Text;
class Box {
double ma, mb, mh;
public Box() {
ma = 0;
mb = 0;
mh = 0;
}
public Box(double ma, double mb, double mh) {
this.ma = ma;
this.mb = mb;
this.mh = mh;
}
public void sides() {
Console.WriteLine("ma = " + this.ma);
Console.WriteLine("mb = " + this.mb);
Console.WriteLine("mh = " + this.mh);
}
public double V() {
return ma * mb * mh;
}
public double S() {
return ma * mb * 2 + ma * mh * 2 + mb * mh * 2;
}
public double a
{
get { return this.ma; }
set { this.ma = value; }
}
public double b
{
get { return this.mb; }
set { this.mb = value; }
}
public double h
{
get { return this.mh; }
set { this.mh = value; }
}
public bool isSquare {
get { return ma == mb; }
}
};
namespace Stela
{
class Program
{
static void Main(string[] args)
{
Box box1 = new Box();
box1.sides();
Box box2 = new Box( 3, 4, 5 );
box2.sides();
Console.WriteLine("box2 V = " + box2.V());
Console.WriteLine("box2 S = " + box2.S());
box1.a = 5;
box1.b = 5;
box1.h = 5;
Console.WriteLine("Box1:");
Console.WriteLine("ma = " + box1.a);
Console.WriteLine("mb = " + box1.b);
Console.WriteLine("mh = " + box1.h);
if (box1.isSquare)
Console.WriteLine( "Osnovata na Box 1 e kvadrat" );
else
Console.WriteLine("Osnovata na Box 1 ne e kvadrat");
HashSet<Box> boxes = new HashSet<Box>();
Random rand = new Random();
for (int i = 0; i < 10; i++ )
{
boxes.Add(new Box(rand.Next(100, 500), rand.Next(100, 500), rand.Next(100, 500)));
}
foreach( Box b in boxes ) {
b.sides();
}
Console.ReadLine();
}
}
}