Part 1 & 2

This commit is contained in:
KäseToatz
2024-09-25 22:24:42 +02:00
commit a33cf50a4c
14 changed files with 382 additions and 0 deletions

23
Buckets.Logic/Bucket.cs Normal file
View File

@ -0,0 +1,23 @@
namespace Buckets.Logic
{
public class Bucket : Container
{
private const int DEFAULT_CAPACITY = 12;
private const int MAX_CAPACITY = 2500;
private const int MIN_CAPACITY = 10;
public Bucket(int content) : base(DEFAULT_CAPACITY, content) {}
public Bucket(int capacity, int content) : base(capacity, content)
{
ArgumentOutOfRangeException.ThrowIfGreaterThan(capacity, MAX_CAPACITY, nameof(capacity));
ArgumentOutOfRangeException.ThrowIfLessThan(capacity, MIN_CAPACITY, nameof(capacity));
}
public void Fill(Bucket bucket)
{
Content += bucket.Content;
bucket.Empty();
}
}
}