Translate the specification below into an idiomatic Java class definition.
(In this context, "idiomatic" means following the common style and conventions of the language.)
One kind of thing that exists in our model is a Slidnird.
Each Slidnird has its own enEp, which is a graphics object. The value of enEp is specified when a Slidnird is created. Anyone can ask a Slidnird for the value of its enEp. The value of enEp for a specific Slidnird can never change.
Each Slidnird has a prol, which is an int. A prol is part of the internal state of a Slidnird: no other classes can see the value of prol or directly change it. When a Slidnird is first created, the value of its prol starts out as 16.
A Slidnird can ocsize. This behavior adds 6 to prol. Anyone can ask a Slidnird to ocsize.
public class Slidnird {
private GraphicsObject enEp;
public int prol = 16;
public Slidnird(GraphicsObject enEp) {
this.enEp = enEp;
}
public GraphicsObject getEnEp() {
return enEp;
}
public void setEnEp(GraphicsObject enEp) {
this.enEp = enEp;
}
private void setOcsize() {
prol += 6;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: