Данный отчёт сгенерирован 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
Описание: Оголосіть клас Ellipse, похідний від абстрактного класу BaseRect, який вже оголошено так:
abstract class BaseRect
{
public virtual double W { set; get; }
public virtual double H { set; get; }
public BaseRect(double w, double h)
{
H = h;
W = w;
}
public virtual double S() { return W * H; }
public virtual double P() { return 2 * (W + H); }
public double R() { return S() / P(); }
}
Для еліпса властивості W і H є шириною та висотою прямокутника, що охоплює еліпс. Еліпс повинен мати конструктор із двома параметрами: w та h.
04.04.2023 06:21:13
Решений: 13
04.04.2023 06:21:13
Полімофний Еліпс
04.04.2023 06:21:13
class Ellipse : BaseRect{public Ellipse(double w, double h):base(w,h){}}
class Ellipse : BaseRect
{
public Ellipse(double w, double h) : base(w, h) { }
public override double S()
{
return (W / 2) * (H / 2) * Math.PI;
}
public override double P()
{
double a = W / 2;
double b = H / 2;
return 2 * Math.PI * Math.Sqrt((a * a + b * b) / 2);
}
}
class Ellipse : BaseRect
{
public Ellipse(double w, double h): base(w, h) {}
}
class Ellipse : BaseRect
{
public Ellipse(double w, double h) : base(w,h){}
}
class Ellipse : BaseRect {
public Ellipse(double w, double h): base(w, h) {}
public override double S() {
return W/2 * H/2 * Math.PI;
}
public override double P() {
return 2*Math.PI*Math.Sqrt((Math.Pow(W/2, 2) + Math.Pow(H/2, 2)) / 2);
}
}
class Ellipse : BaseRect
{
public Ellipse(double w, double h) : base(w, h) { }
public override double S() { return (W/2) * (H/2) * Math.PI; }
public override double P() { return 2 * Math.PI * Math.Sqrt((W/2 * W/2 + H/2 * H/2) / 2); }
}
class Ellipse : BaseRect
{
public Ellipse(double w, double h) : base(w, h) { }
public override double S() { return (W/2) * (H/2) * Math.PI;}
public override double P() { return 2 * Math.PI * Math.Sqrt((W/2 * W/2 + H/2 * H/2) / 2); }
}
class Ellipse : BaseRect{
public Ellipse(double w, double h) : base(w,h){}
}
class Ellipse : BaseRect
{
public Ellipse(double w, double h) : base(w,h)
{
}
}
class Ellipse : BaseRect {
public Ellipse(double w, double h) : base(w, h) {
}
}
class Ellipse : BaseRect{
public override double S() { return Math.PI*W/2 * H/2; }
public override double P() { return 2 * Math.PI*Math.Sqrt((W/2*W/2+H / 2 *H / 2)/2); }
public Ellipse(double w, double h) : base(w, h)
{
}
}
class Ellipse : BaseRect
{
public Ellipse(double w, double h) : base(w, h){}
}
class Ellipse : BaseRect {
public Ellipse(double w, double h): base(w, h) {}
public override double S() { return Math.PI * W * H / 4; }
public override double P()
{
double a = W / 2;
double b = H / 2;
return 2 * Math.PI * Math.Sqrt((a * a + b * b) / 2);
}
}
{
public Ellipse(double w, double h) : base(w, h) { }
public override double S()
{
return (W / 2) * (H / 2) * Math.PI;
}
public override double P()
{
double a = W / 2;
double b = H / 2;
return 2 * Math.PI * Math.Sqrt((a * a + b * b) / 2);
}
}
{
public Ellipse(double w, double h): base(w, h) {}
}
{
public Ellipse(double w, double h) : base(w,h){}
}
public Ellipse(double w, double h): base(w, h) {}
public override double S() {
return W/2 * H/2 * Math.PI;
}
public override double P() {
return 2*Math.PI*Math.Sqrt((Math.Pow(W/2, 2) + Math.Pow(H/2, 2)) / 2);
}
}
{
public Ellipse(double w, double h) : base(w, h) { }
public override double S() { return (W/2) * (H/2) * Math.PI; }
public override double P() { return 2 * Math.PI * Math.Sqrt((W/2 * W/2 + H/2 * H/2) / 2); }
}
{
public Ellipse(double w, double h) : base(w, h) { }
public override double S() { return (W/2) * (H/2) * Math.PI;}
public override double P() { return 2 * Math.PI * Math.Sqrt((W/2 * W/2 + H/2 * H/2) / 2); }
}
public Ellipse(double w, double h) : base(w,h){}
}
{
public Ellipse(double w, double h) : base(w,h)
{
}
}
public Ellipse(double w, double h) : base(w, h) {
}
}
public override double S() { return Math.PI*W/2 * H/2; }
public override double P() { return 2 * Math.PI*Math.Sqrt((W/2*W/2+H / 2 *H / 2)/2); }
public Ellipse(double w, double h) : base(w, h)
{
}
}
{
public Ellipse(double w, double h) : base(w, h){}
}
public Ellipse(double w, double h): base(w, h) {}
public override double S() { return Math.PI * W * H / 4; }
public override double P()
{
double a = W / 2;
double b = H / 2;
return 2 * Math.PI * Math.Sqrt((a * a + b * b) / 2);
}
}