public class
Case
{
private Bottle[] bots;
public Case(int totalBottles)
{
bots = new
Bottle[totalBottles];
for (int i=0; i<bots.length; i++)
{
bots[i] = new Bottle(750, "Blue");
}
}
public int getNumberOfBottles()
{
return bots.length;
}
public
Bottle getBottle(int index)
{
return bots[index];
}
public
String toString()
{
String s = "";
for (int i=0; i<bots.length; i++)
{
s = s + bots[i].toString() +
"\n";
}
return s;
}
public void fillBottles(String
liquid)
{
for (int i=0; i<bots.length; i++)
{
int remainingVol = bots[i].getRemainingVolume();
bots[i].addLiquid(liquid, remainingVol);
}
}
}
|