rendered paste bodyusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Box {
private 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 Dimentions() {
Console.WriteLine( "Dimentions:" );
Console.WriteLine( "ma = " + ma + "\nmb = " + mb + "\nmh = " + mh );
}
public double S() {
return ma * mb * 2 + ma * mh * 2 + mb * mh * 2;
}
public double V() {
return ma * mb * mh;
}
public double MA
{
get { return ma; }
set { ma = value; }
}
public double MB
{
get { return mb; }
set { mb = value; }
}
public double MH
{
get { return mh; }
set { mh = value; }
}
public bool isSquare {
get { return ma == mb; }
}
}
namespace IT3_1906
{
class Program
{
static void Main(string[] args)
{
Box a = new Box(1, 2, 3);
Box b = new Box();
// Dimentions + constructors
a.Dimentions();
b.Dimentions();
// Setters
b.MA = 4;
b.MB = 4;
b.MH = 5;
b.Dimentions();
// Getters
Console.WriteLine( "A:\nma = " + a.MA + "\nmb = " + a.MB + "\nmh = " + a.MH );
// IsSquare
Console.WriteLine("a - " + ( a.isSquare ? "Kvadrat" : "Ne e kvadrat" ) );
Console.WriteLine("b - " + ( b.isSquare ? "Kvadrat" : "Ne e kvadrat" ) );
// Zadacha 2
List<Box> Boxes = new List<Box>;
Random rand = new Random();
for (int i = 0; i < 10; i++ )
{
Boxes.Add( new Box(rand.Next(110, 200), rand.Next(110, 200), rand.Next(110, 200)) );
Console.WriteLine( "\nBoxes[" + i + "]:" );
Boxes[i].Dimentions();
}
Console.ReadLine();
}
}
}