Weight of Box finished
After implementing the Measurable interface, the constant weight of Boxes in the int weight method is 5. Attribute int weight, methods set- and getWeight were removed.
This commit is contained in:
parent
a30cb01cd0
commit
6868baec84
@ -2,32 +2,14 @@ package cicaprojekt;
|
|||||||
|
|
||||||
public class Box implements cicaprojekt.Pickable, cicaprojekt.Destroyable
|
public class Box implements cicaprojekt.Pickable, cicaprojekt.Destroyable
|
||||||
{
|
{
|
||||||
private int weight;
|
|
||||||
|
|
||||||
public Box(int w){
|
public Box(){
|
||||||
Menu.addTab();
|
Menu.addTab();
|
||||||
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.Box(" + w + ")");
|
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.Box()");
|
||||||
weight = w;
|
|
||||||
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.Box()");
|
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.Box()");
|
||||||
Menu.removeTab();
|
Menu.removeTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWeight(){
|
|
||||||
Menu.addTab();
|
|
||||||
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.getWeight()");
|
|
||||||
return weight;
|
|
||||||
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.getWeight()");
|
|
||||||
Menu.removeTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWeight(int w){
|
|
||||||
Menu.addTab();
|
|
||||||
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.setWeight(" + w + ")");
|
|
||||||
weight = w;
|
|
||||||
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.setWeight()");
|
|
||||||
Menu.removeTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Menu.addTab();
|
Menu.addTab();
|
||||||
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.destroy()");
|
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.destroy()");
|
||||||
@ -41,4 +23,13 @@ public class Box implements cicaprojekt.Pickable, cicaprojekt.Destroyable
|
|||||||
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.pick()");
|
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.pick()");
|
||||||
Menu.removeTab();
|
Menu.removeTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int weight() {
|
||||||
|
Menu.addTab();
|
||||||
|
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.weight()");
|
||||||
|
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Box.weight()");
|
||||||
|
Menu.removeTab();
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user