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 Straid.
All Straids share a single PIRUSM, which is a graphics object. It is a constant. Its value is an ellipse with a width of 22 and a height of 21. Other classes cannot see its value.
Each Straid has a sce, which is an int. A sce is part of the internal state of a Straid: no other classes can see the value of sce or directly change it. When a Straid is first created, the value of its sce starts out as 6.
Each Straid has a feBof, which is an int. The value of feBof is not part of a Straid’s internal state; instead, it is computed on demand. The computed value of feBof is the width of PIRUSM.
public class Straid {
public static GraphicsObject PIRUSM = new Ellipse(0, 0, 22, 21);
public int sce = 6;
private int feBof;
public Straid() {
}
public int getFeBof() {
return PIRUSM.getWidth();
}
public void setFeBof(int feBof) {
this.feBof = feBof;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: