Added Shapes

This commit is contained in:
MarcUs7i 2025-03-13 16:53:57 +01:00
parent 86fea33323
commit 6e4ae6838e
6 changed files with 50 additions and 1 deletions

3
.gitignore vendored
View file

@ -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
View file

@ -0,0 +1,7 @@
namespace Shapes.Shapes;
public sealed class Circle : Shape
{
const int RadiusMin = 5;
const int RadiusMax = 100;
}

View 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
View 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
View file

@ -0,0 +1,7 @@
namespace Shapes.Shapes;
public sealed class Square : Shape
{
const int SideLengthMin = 10;
const int SideLengthMax = 120;
}

View file

@ -0,0 +1,7 @@
namespace Shapes.Shapes;
public sealed class Triangle : Shape
{
const int SideLengthMin = 10;
const int SideLengthMax = 150;
}