public static void Main()
capacity = int.Parse(Console.ReadLine());
while (currentAmount <= 0 && currentAmount >= capacity)
currentAmount = int.Parse(Console.ReadLine());
Bucket b1 = new Bucket(capacity, currentAmount);
Console.WriteLine(b1.ToString());
Bucket b2 = new Bucket (capacity,currentAmount);
int num=int.Parse(Console.ReadLine());
num=int.Parse(Console.ReadLine());
num=int.Parse(Console.ReadLine());
private double currentAmount;
public Bucket(int capacity, double currentAmount)
this.capacity = capacity;
this.currentAmount = currentAmount;
public void EmptyAmount(double amountToEmpty)
this.currentAmount = Math.Max(currentAmount - amountToEmpty, 0);
return (currentAmount <= 0);
public void Fill(double amountToFill)
currentAmount = Math.Min(currentAmount + amountToFill, capacity);
if((currentAmount+amountToFill)>capacity)
Console.WriteLine("odef is " + ((currentAmount + amountToFill) - capacity));
this.currentAmount = this.capacity;
if(this.capacity==this.currentAmount)
public double GetCurrentAmount()
return this.currentAmount;
public void PourInto(Bucket bucketInto)
double bucketResCapacity = bucketInto.GetCapacity() - bucketInto.GetCurrentAmount();
double amountToFill = Math.Min(currentAmount, bucketResCapacity);
bucketInto.Fill(amountToFill);
currentAmount -= amountToFill;
override public string ToString()
return "The capacity: " + capacity + "\nThe current amount of water: " + currentAmount;
public Box(double length, double width, double height)
public double GetLength()
public double GetHeight()
public void SetLength(double length)
public void SetWidth(double width)
public void SetHeight(double height)
public double GetVolume()
return this.length * this.width * this.height;
public override string ToString()
return "length: " + this.length + " width: " + this.width + " height: " + this.height;
public ColoredBox(double length, double width, double height, string color)
public double GetLength()
public double GetHeight()
public void SetLength(double length)
public void SetWidth(double width)
public void SetHeight(double height)
public void SetColor(string color)
public double GetVolume()
return this.length * this.width * this.height;
public override string ToString()
return "length: " + this.length + " width: " + this.width + " height: " + this.height + " color: " + this.color;