I am currently writing a program that simulates a coffee machine. The machine has three containers(milk,water,and coffee). There is therefore a Container class and a WaterTank class. The WaterTank class inherits from the Container class.
-Class Container contains the methods releaseContent(), amountLeft(), and resetVolumeContained().
The class looks like this with the constructor:
public class Container {
private int volumeContained; private int minimumVolume; Valve mainValve; WarningLight mainLight;
public Container(int vContained, int minVolume) { volumeContained = vContained; minimumVolume = minVolume; mainValve = new Valve(); mainLight = new WarningLight(); } and then the methods I mentioned above...
-Class WaterTank only contains one method called heatWater().
It probably sounds stupid, but how do I link them?
> I am currently writing a program that simulates a > coffee machine. The machine has three > containers(milk,water,and coffee). There is > therefore a Container class and a WaterTank class. > The WaterTank class inherits from the Container > class. > > -Class Container contains the methods > releaseContent(), amountLeft(), and > resetVolumeContained(). > > The class looks like this with the constructor: > > public class Container { > > private int volumeContained; > private int minimumVolume; > Valve mainValve; > WarningLight mainLight; > > public Container(int vContained, int minVolume) > { > volumeContained = vContained; > minimumVolume = minVolume; > mainValve = new Valve(); > mainLight = new WarningLight(); > } > and then the methods I mentioned above... > > -Class WaterTank only contains one method called > heatWater(). > > It probably sounds stupid, but how do I link them?
public class WaterTank extends Container is that what you're really askihg or am I too dumb?