Данный отчёт сгенерирован 04.04.2023 06:21:13 UTC.
HTML версия (этот сайт) сгенерирован 04.04.2023 06:21:31 UTC.
Коммит: [bfeb65b9] add automatic zip creation 04.04.2023 06:21:13
HTML версия (этот сайт) сгенерирован 04.04.2023 06:21:31 UTC.
Коммит: [bfeb65b9] add automatic zip creation 04.04.2023 06:21:13
Задача: Кремезний Прямокутник
04.04.2023 06:21:13
Описание: Оголосіть клас BaseRect - прямокутник із двома відкритими цілими властивостями: W - ширина і H - висота прямокутника.
У класі має бути відкритий конструктор із двома параметрами, менший з яких задає висоту, а більший – основу прямокутника.
Властивості не повинні допускати того, що висота прямокутника стане більшою за основу, спроби таких змін повинні спричиняти виключення ArgumentException.
04.04.2023 06:21:13
Решений: 19
04.04.2023 06:21:13
Кремезний Прямокутник
04.04.2023 06:21:13
class BaseRect {
private int width;
private int height;
public BaseRect(int w, int h) {
if(w < h) {
int t = w;
w = h;
h = t;
}
width = w;
height = h;
}
public int W {
get { return width; }
set {
if (value < height)
throw new ArgumentException("Висота повинна бути менше основи.");
width = value;
}
}
public int H {
get { return height; }
set {
if (value > width)
throw new ArgumentException("Висота повинна бути менше основи.");
height = value;
}
}
}
class BaseRect
{
private int w;
private int h;
public BaseRect(int W, int H)
{
w = W;
h = H;
}
public int H
{
get { return h; }
set {
if (value > w)
throw new ArgumentException("");
h = value; }
}
public int W
{
get { return w; }
set { if(value < h)
throw new ArgumentException("");
w = value;
}
}
}
class BaseRect
{
private int width;
private int height;
public int W
{
get { return width; }
set
{
if (value < height) {
throw new ArgumentException();
}
width = value;
}
}
public int H
{
get { return height; }
set
{
if (value > width) {
throw new ArgumentException();
}
height = value;
}
}
public BaseRect(int a, int b)
{
if (a < b)
{
height = a;
width = b;
}
else
{
height = b;
width = a;
}
}
}
class BaseRect
{
private int width;
private int height;
public BaseRect(int a, int b)
{
if(a > b)
{
width = a;
height = b;
}
else
{
height = a;
width = b;
}
}
public int W
{
get
{
return width;
}
set
{
if ( value > height)
{
width = value;
}
else
{
throw new ArgumentException();
}
}
}
public int H
{
get
{
return height;
}
set
{
if ( value < width)
{
height = value;
}
else
{
throw new ArgumentException();
}
}
}
}
class BaseRect
{
private int w, h;
public int W
{
set
{
if (value < this.h)
{
throw new ArgumentException();
}
else this.w = value;
}
get => w;
}
public int H
{
set
{
if (value > this.w)
{
throw new ArgumentException();
}
else this.h = value;
}
get => h;
}
public BaseRect(int W, int H)
{
int min, maks;
if (W > H) { maks = W; min = H; }
else { min = W; maks = H; }
this.h = min;
this.w = maks;
}
}
public class BaseRect
{
private int w;
private int h;
public BaseRect(int a, int b)
{
if (a > b)
{
w = a;
h = b;
}
else
{
w = b;
h = a;
}
}
public int W
{
get { return w; }
set
{
if (value < h)
{
throw new ArgumentException("Height cannot be greater than base.");
}
w = value;
}
}
public int H
{
get { return h; }
set
{
if (value > w)
{
throw new ArgumentException("Height cannot be greater than base.");
}
h = value;
}
}
}
class BaseRect
{
private int w;
private int h;
public int W {
get { return w;}
set {
if (value < h)
throw new ArgumentException("Error");
w = value;
}
}
public int H {
get { return h;}
set {
if (value > w)
throw new ArgumentException("Error");
h = value;
}
}
public BaseRect(int p1, int p2){
if(p1 >= p2){
W = p1;
H = p2;
}
else{
W = p2;
H = p1;
}
}
}
public class BaseRect{
private double w;
private double h;
public double W{
get {return w;}
set{
if(value< h){
throw new ArgumentException();
}
w=value;
}
}
public double H{
get {return h;}
set{
if(value>w){
throw new ArgumentException();
}
h=value;
}
}
public BaseRect(double wd, double ht){
this.w=wd;
this.h=ht;
}
}
class BaseRect {
private int w;
private int h;
public int W {
set {
if (value < h)
throw new ArgumentException("NO");
w = value;
}
get { return w; }
}
public int H {
set {
if (value > w)
throw new ArgumentException("NO");
h = value;
}
get { return h; }
}
public BaseRect(int p1, int p2) {
if (p1 > p2) {
w = p1;
h = p2;
} else {
w = p2;
h = p1;
}
}
}
class BaseRect{
private int w1;
private int h1;
public int W{
get{return w1;}
set{
if(value < h1) throw new ArgumentException("Ширина не може бути менше висоти.");
w1=value;}
}
public int H{
get{return h1;}
set{
if(value > w1) throw new ArgumentException("Висота не може бути більше ширини.");
h1 = value;
}
}
public BaseRect(int a, int b){
if(a>b){
w1 = a;
h1 = b;
}
else{
w1 = b;
h1 = a;
}
}
}
class BaseRect {
private int width;
private int height;
public int H {
get { return height; }
set {
if(width < value) throw new ArgumentException();
height = value;
}
}
public int W {
get { return width; }
set {
if(value < height) throw new ArgumentException();
width = value;
}
}
public BaseRect(int side1, int side2) {
if(side1 < side2) {
this.width = side2;
this.height = side1;
} else {
this.width = side1;
this.height = side2;
}
}
}
public class BaseRect
{
private int w;
private int h;
public BaseRect(int a, int b)
{
if (a < b)
{
h = a;
w = b;
}
else
{
h = b;
w = a;
}
if (h > w)
{
throw new ArgumentException("Height cannot be greater than Width.");
}
}
public int W
{
get { return w; }
set
{
if (value < h)
{
throw new ArgumentException("Width cannot be less than Height.");
}
w = value;
}
}
public int H
{
get { return h; }
set
{
if (value > w)
{
throw new ArgumentException("Height cannot be greater than Width.");
}
h = value;
}
}
}
class BaseRect{
public int Width = 0;
public int Height = 0;
public int W {
set{
if(value < Height) throw new ArgumentException();
Width = value;
}
get{return Width;}
}
public int H {
set{
if(value > Width) throw new ArgumentException();
Height = value;
}
get{return Height;}
}
public BaseRect(int i1, int i2){
Width = Math.Max(i1, i2);
Height = Math.Min(i1, i2);
}
}
public class BaseRect
{
private int w;
private int h;
public BaseRect(int arg1, int arg2) {
this.w = arg1;
this.h = arg2;
}
public int W {
get { return w; }
set {
if (h > value) throw new ArgumentException();
w = value;
}
}
public int H {
get { return h; }
set {
if (value > w) throw new ArgumentException();
h = value;
}
}
}
class BaseRect
{
int width;
int height;
public int W
{
get { return width; }
set
{
if (value < height || value < 0)
throw new ArgumentException();
width = value;
}
}
public int H
{
get { return height; }
set
{
if (value > width || value < 0)
throw new ArgumentException();
height = value;
}
}
public BaseRect (int i, int j)
{
if (i > j)
{
this.height = j;
this.width = i;
}
else
{
this.height = i;
this.width = j;
}
}
}
public class BaseRect
{
private int w;
private int h;
public int W
{
get { return w; }
set
{
if (value < h)
{
throw new ArgumentException("Width cannot be less than Height");
}
w = value;
}
}
public int H
{
get { return h; }
set
{
if (value > w)
{
throw new ArgumentException("Height cannot be greater than Width");
}
h = value;
}
}
public BaseRect(int a, int b)
{
if (a > b)
{
h = b;
w = a;
}
else
{
h = a;
w = b;
}
if (h > w)
{
throw new ArgumentException("Height cannot be greater than Width");
}
}
}
public class BaseRect
{
private int w;
private int h;
public int W
{
get { return w; }
set
{
if (value < h)
{
throw new ArgumentException("Width cannot be less than Height");
}
w = value;
}
}
public int H
{
get { return h; }
set
{
if (value > w)
{
throw new ArgumentException("Height cannot be greater than Width");
}
h = value;
}
}
public BaseRect(int a, int b)
{
if (a > b)
{
h = b;
w = a;
}
else
{
h = a;
w = b;
}
if (h > w)
{
throw new ArgumentException("Height cannot be greater than Width");
}
}
}
public class BaseRect {
private int w;
private int h;
public int W {
get { return w; }
set {
if (value < H) {
throw new ArgumentException("Висота повинна бути менше основи.");
}
w = value;
}
}
public int H {
get => h;
set {
if (value > W) {
throw new ArgumentException("Висота повинна бути менше основи.");
}
h = value;
}
}
public BaseRect(int a, int b) {
w = Math.Max(a, b);
h = Math.Min(a, b);
}
}
public class BaseRect
{
private int w;
private int h;
public int W
{
get { return w; }
set
{
if (value <= 0)
throw new ArgumentException("Ширина має бути більше 0.");
if (value < h)
throw new ArgumentException("Ширина має бути більшою або дорівнювати висоті.");
w = value;
}
}
public int H
{
get { return h; }
set
{
if (value <= 0)
throw new ArgumentException("Висота має бути більше 0.");
if (value > w)
throw new ArgumentException("Висота має бути меншою або дорівнювати ширині.");
h = value;
}
}
public BaseRect(int a, int b)
{
if (a <= 0 || b <= 0)
throw new ArgumentException("Розміри мають бути більші за 0.");
if (a < b)
{
W = b;
H = a;
}
else
{
W = a;
H = b;
}
}
}
private int width;
private int height;
public BaseRect(int w, int h) {
if(w < h) {
int t = w;
w = h;
h = t;
}
width = w;
height = h;
}
public int W {
get { return width; }
set {
if (value < height)
throw new ArgumentException("Висота повинна бути менше основи.");
width = value;
}
}
public int H {
get { return height; }
set {
if (value > width)
throw new ArgumentException("Висота повинна бути менше основи.");
height = value;
}
}
}
{
private int w;
private int h;
public BaseRect(int W, int H)
{
w = W;
h = H;
}
public int H
{
get { return h; }
set {
if (value > w)
throw new ArgumentException("");
h = value; }
}
public int W
{
get { return w; }
set { if(value < h)
throw new ArgumentException("");
w = value;
}
}
}
{
private int width;
private int height;
public int W
{
get { return width; }
set
{
if (value < height) {
throw new ArgumentException();
}
width = value;
}
}
public int H
{
get { return height; }
set
{
if (value > width) {
throw new ArgumentException();
}
height = value;
}
}
public BaseRect(int a, int b)
{
if (a < b)
{
height = a;
width = b;
}
else
{
height = b;
width = a;
}
}
}
{
private int width;
private int height;
public BaseRect(int a, int b)
{
if(a > b)
{
width = a;
height = b;
}
else
{
height = a;
width = b;
}
}
public int W
{
get
{
return width;
}
set
{
if ( value > height)
{
width = value;
}
else
{
throw new ArgumentException();
}
}
}
public int H
{
get
{
return height;
}
set
{
if ( value < width)
{
height = value;
}
else
{
throw new ArgumentException();
}
}
}
}
{
private int w, h;
public int W
{
set
{
if (value < this.h)
{
throw new ArgumentException();
}
else this.w = value;
}
get => w;
}
public int H
{
set
{
if (value > this.w)
{
throw new ArgumentException();
}
else this.h = value;
}
get => h;
}
public BaseRect(int W, int H)
{
int min, maks;
if (W > H) { maks = W; min = H; }
else { min = W; maks = H; }
this.h = min;
this.w = maks;
}
}
{
private int w;
private int h;
public BaseRect(int a, int b)
{
if (a > b)
{
w = a;
h = b;
}
else
{
w = b;
h = a;
}
}
public int W
{
get { return w; }
set
{
if (value < h)
{
throw new ArgumentException("Height cannot be greater than base.");
}
w = value;
}
}
public int H
{
get { return h; }
set
{
if (value > w)
{
throw new ArgumentException("Height cannot be greater than base.");
}
h = value;
}
}
}
{
private int w;
private int h;
public int W {
get { return w;}
set {
if (value < h)
throw new ArgumentException("Error");
w = value;
}
}
public int H {
get { return h;}
set {
if (value > w)
throw new ArgumentException("Error");
h = value;
}
}
public BaseRect(int p1, int p2){
if(p1 >= p2){
W = p1;
H = p2;
}
else{
W = p2;
H = p1;
}
}
}
private double w;
private double h;
public double W{
get {return w;}
set{
if(value< h){
throw new ArgumentException();
}
w=value;
}
}
public double H{
get {return h;}
set{
if(value>w){
throw new ArgumentException();
}
h=value;
}
}
public BaseRect(double wd, double ht){
this.w=wd;
this.h=ht;
}
}
private int w;
private int h;
public int W {
set {
if (value < h)
throw new ArgumentException("NO");
w = value;
}
get { return w; }
}
public int H {
set {
if (value > w)
throw new ArgumentException("NO");
h = value;
}
get { return h; }
}
public BaseRect(int p1, int p2) {
if (p1 > p2) {
w = p1;
h = p2;
} else {
w = p2;
h = p1;
}
}
}
private int w1;
private int h1;
public int W{
get{return w1;}
set{
if(value < h1) throw new ArgumentException("Ширина не може бути менше висоти.");
w1=value;}
}
public int H{
get{return h1;}
set{
if(value > w1) throw new ArgumentException("Висота не може бути більше ширини.");
h1 = value;
}
}
public BaseRect(int a, int b){
if(a>b){
w1 = a;
h1 = b;
}
else{
w1 = b;
h1 = a;
}
}
}
private int width;
private int height;
public int H {
get { return height; }
set {
if(width < value) throw new ArgumentException();
height = value;
}
}
public int W {
get { return width; }
set {
if(value < height) throw new ArgumentException();
width = value;
}
}
public BaseRect(int side1, int side2) {
if(side1 < side2) {
this.width = side2;
this.height = side1;
} else {
this.width = side1;
this.height = side2;
}
}
}
{
private int w;
private int h;
public BaseRect(int a, int b)
{
if (a < b)
{
h = a;
w = b;
}
else
{
h = b;
w = a;
}
if (h > w)
{
throw new ArgumentException("Height cannot be greater than Width.");
}
}
public int W
{
get { return w; }
set
{
if (value < h)
{
throw new ArgumentException("Width cannot be less than Height.");
}
w = value;
}
}
public int H
{
get { return h; }
set
{
if (value > w)
{
throw new ArgumentException("Height cannot be greater than Width.");
}
h = value;
}
}
}
public int Width = 0;
public int Height = 0;
public int W {
set{
if(value < Height) throw new ArgumentException();
Width = value;
}
get{return Width;}
}
public int H {
set{
if(value > Width) throw new ArgumentException();
Height = value;
}
get{return Height;}
}
public BaseRect(int i1, int i2){
Width = Math.Max(i1, i2);
Height = Math.Min(i1, i2);
}
}
{
private int w;
private int h;
public BaseRect(int arg1, int arg2) {
this.w = arg1;
this.h = arg2;
}
public int W {
get { return w; }
set {
if (h > value) throw new ArgumentException();
w = value;
}
}
public int H {
get { return h; }
set {
if (value > w) throw new ArgumentException();
h = value;
}
}
}
{
int width;
int height;
public int W
{
get { return width; }
set
{
if (value < height || value < 0)
throw new ArgumentException();
width = value;
}
}
public int H
{
get { return height; }
set
{
if (value > width || value < 0)
throw new ArgumentException();
height = value;
}
}
public BaseRect (int i, int j)
{
if (i > j)
{
this.height = j;
this.width = i;
}
else
{
this.height = i;
this.width = j;
}
}
}
{
private int w;
private int h;
public int W
{
get { return w; }
set
{
if (value < h)
{
throw new ArgumentException("Width cannot be less than Height");
}
w = value;
}
}
public int H
{
get { return h; }
set
{
if (value > w)
{
throw new ArgumentException("Height cannot be greater than Width");
}
h = value;
}
}
public BaseRect(int a, int b)
{
if (a > b)
{
h = b;
w = a;
}
else
{
h = a;
w = b;
}
if (h > w)
{
throw new ArgumentException("Height cannot be greater than Width");
}
}
}
{
private int w;
private int h;
public int W
{
get { return w; }
set
{
if (value < h)
{
throw new ArgumentException("Width cannot be less than Height");
}
w = value;
}
}
public int H
{
get { return h; }
set
{
if (value > w)
{
throw new ArgumentException("Height cannot be greater than Width");
}
h = value;
}
}
public BaseRect(int a, int b)
{
if (a > b)
{
h = b;
w = a;
}
else
{
h = a;
w = b;
}
if (h > w)
{
throw new ArgumentException("Height cannot be greater than Width");
}
}
}
private int w;
private int h;
public int W {
get { return w; }
set {
if (value < H) {
throw new ArgumentException("Висота повинна бути менше основи.");
}
w = value;
}
}
public int H {
get => h;
set {
if (value > W) {
throw new ArgumentException("Висота повинна бути менше основи.");
}
h = value;
}
}
public BaseRect(int a, int b) {
w = Math.Max(a, b);
h = Math.Min(a, b);
}
}
{
private int w;
private int h;
public int W
{
get { return w; }
set
{
if (value <= 0)
throw new ArgumentException("Ширина має бути більше 0.");
if (value < h)
throw new ArgumentException("Ширина має бути більшою або дорівнювати висоті.");
w = value;
}
}
public int H
{
get { return h; }
set
{
if (value <= 0)
throw new ArgumentException("Висота має бути більше 0.");
if (value > w)
throw new ArgumentException("Висота має бути меншою або дорівнювати ширині.");
h = value;
}
}
public BaseRect(int a, int b)
{
if (a <= 0 || b <= 0)
throw new ArgumentException("Розміри мають бути більші за 0.");
if (a < b)
{
W = b;
H = a;
}
else
{
W = a;
H = b;
}
}
}