Added Shapes
This commit is contained in:
parent
86fea33323
commit
6e4ae6838e
6 changed files with 50 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -581,3 +581,6 @@ FodyWeavers.xsd
|
||||||
# Additional files built by Visual Studio
|
# Additional files built by Visual Studio
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/csharp,visualstudio
|
# End of https://www.toptal.com/developers/gitignore/api/csharp,visualstudio
|
||||||
|
|
||||||
|
# Rider
|
||||||
|
.idea/
|
||||||
|
|
|
||||||
7
Shapes/Shapes/Circle.cs
Normal file
7
Shapes/Shapes/Circle.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace Shapes.Shapes;
|
||||||
|
|
||||||
|
public sealed class Circle : Shape
|
||||||
|
{
|
||||||
|
const int RadiusMin = 5;
|
||||||
|
const int RadiusMax = 100;
|
||||||
|
}
|
||||||
7
Shapes/Shapes/Rectangle.cs
Normal file
7
Shapes/Shapes/Rectangle.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace Shapes.Shapes;
|
||||||
|
|
||||||
|
public sealed class Rectangle : Shape
|
||||||
|
{
|
||||||
|
const int SideLengthMin = 10;
|
||||||
|
const int SideLengthMax = 150;
|
||||||
|
}
|
||||||
18
Shapes/Shapes/Shape.cs
Normal file
18
Shapes/Shapes/Shape.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
namespace Shapes.Shapes;
|
||||||
|
|
||||||
|
public abstract class Shape
|
||||||
|
{
|
||||||
|
private static int _nextId = 1;
|
||||||
|
public int Id { get; }
|
||||||
|
public int Height { get; set; }
|
||||||
|
public int Width { get; set; }
|
||||||
|
|
||||||
|
protected Shape()
|
||||||
|
{
|
||||||
|
Id = _nextId++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool DrawSelf() => true;
|
||||||
|
public virtual bool Draw(int height, int width) => true;
|
||||||
|
public virtual bool Delete() => true;
|
||||||
|
}
|
||||||
7
Shapes/Shapes/Square.cs
Normal file
7
Shapes/Shapes/Square.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace Shapes.Shapes;
|
||||||
|
|
||||||
|
public sealed class Square : Shape
|
||||||
|
{
|
||||||
|
const int SideLengthMin = 10;
|
||||||
|
const int SideLengthMax = 120;
|
||||||
|
}
|
||||||
7
Shapes/Shapes/Triangle.cs
Normal file
7
Shapes/Shapes/Triangle.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace Shapes.Shapes;
|
||||||
|
|
||||||
|
public sealed class Triangle : Shape
|
||||||
|
{
|
||||||
|
const int SideLengthMin = 10;
|
||||||
|
const int SideLengthMax = 150;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue