/** ~mohammad/public_html/classes/csc241/Tank/displayableTank.java Provide the applet with a derivation of Tank that is displayable. displayableTank needs a 200X200 area to draw correctly and the x,y coordinates at the time of construction identify the upper left corner of the tank for display on the applet's canvas. The width and height of the applet need to be large enough to accomodate the tank as well as the other componants displayed. Add, remove, content, capacity will all be adopted from the Tank class. No need to copy/write anything for them. This class has a display method that draws the Tank. Dimension as stated before will be 200X200 and water color will be green. **/ import java.awt.*; public class displayTank extends Tank { protected static final Color fillColor = Color.white; protected static final Color borderColor = Color.black; protected static final Color fluidColor = Color.green; protected int height_ = 200; protected int width_ = 200; protected int x_; protected int y_; public displayTank(int x, int y) { super(); //Invoke the class Tank's constructor x_ = x; y_ = y; } public int x () {return x_;} //return x-coordinate public int y () {return y_;} //return y-coordinate public int height () {return height_;} //return height public int width () {return width_;} //return width //Draw the Tank public void display (Graphics g) { g.setColor(borderColor); g.drawRect(x_,y_,width_,height_); g.drawRect(x_+1,y_+1,width_-2,height_-2); int fluidHeight = (int)(content_ / capacity * height_); g.setColor(fluidColor); g.fillRect(x_+2,height_+y_-fluidHeight+2,width_-4,fluidHeight-4); int emptyHeight = height_ - fluidHeight; g.setColor(fillColor); g.fillRect(x_+2,y_+2,width_-4,emptyHeight-4); } }