Part 1 & 2
This commit is contained in:
15
Buckets.Logic/Rainbarrel.cs
Normal file
15
Buckets.Logic/Rainbarrel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace Buckets.Logic
|
||||
{
|
||||
public class Rainbarrel : Container
|
||||
{
|
||||
private readonly int[] ALLOWED_CAPACITIES = [80, 100, 120];
|
||||
|
||||
public Rainbarrel(int capacity, int content) : base(capacity, content)
|
||||
{
|
||||
if (!ALLOWED_CAPACITIES.Contains(capacity))
|
||||
{
|
||||
throw new ArgumentException($"Capacity must be one of the following values: {string.Join(", ", ALLOWED_CAPACITIES)}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user