Coder Social home page Coder Social logo

task1's Introduction

Базовий абстрактний клас – Фігура, похідні від нього Коло та Прямокутник. Паралелепіпед унаслідується від Прямокутника, Циліндр – від Коло. Визначити:

  • Конструктори
  • Колір та ширину контура
  • Колір заливки
  • Площу, периметр
  • Специфічні властивості чи методи для похідних класів (об’єм для циліндра наприклад).

Створити колекцію різних фігур. Порахувати сумарний периметр та площу всіх фігур.

Терновий Іван

task1's People

Contributors

ivanternovyi avatar

task1's Issues

Override ToString() method

It's better to override ToString() method, it will be called in System.Console.Write() method automatically. And also override it in derived classes.

public virtual void Output()
{
Console.Write($"Countour(Colour: { contour }, Width: { contourWidth }), Filling: {filling} ");
}

Validating before assignment

Validate contourWidth field after assigning, or it will be better to validate width before assigning it to contourWidth.

protected Shape(Colour contour = Colour.Green, Colour filling = Colour.Green, double width = 0)
{
this.contour = contour;
this.filling = filling;
if(contourWidth < 0)
throw new ArgumentException("Value should be > 0");
contourWidth = width;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.