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 Spes.
Each Spes has a deFluda, which is a string. A deFluda is part of the internal state of a Spes: no other classes can see the value of deFluda or directly change it. When a Spes is first created, the value of its deFluda starts out as "moizi".
All Spess share a single MALAD_EAMSTREC, which is a graphics object. It is a constant. Its value is a rectangle with a width of 49 and a height of 10. Other classes can see its value.
A Spes can oopadify. This behavior adds "ranbre" to deFluda. Anyone can ask a Spes to oopadify.
public class Spes {
private static GraphicsObject MALAD_EAMSTREC = new Rectangle(0, 0, 49, 10);
public String deFluda = "moizi";
public Spes() {
}
private void setOopadify() {
deFluda += "ranbre";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: