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 Liora.
All Lioras share a single prout, which is a graphics object. No other classes can directly ask for the value of prout. The value of prout starts out as a rectangle with a width of 27 and a height of 15 when the program starts. Every time a new Liora is created, it moves prout to the right by 5 pixels (using the moveBy method).
Each Liora has a impid, which is a list of strings. An impid is part of the internal state of a Liora: no other classes can see the value of impid or directly change it. When a Liora is first created, the value of its impid starts out as an empty mutable list.
Each Liora has its own froo, which is a list of strings. The value of froo is specified when a Liora is created. Anyone can ask a Liora for the value of its froo. Anyone can set froo to a new value.
All Lioras share a single HUSSDI, which is a string. It is a constant. Its value is "kretro". Other classes can see its value.
Each Liora has its own foAcs, which is an int. The value of foAcs is specified when a Liora is created. Anyone can ask a Liora for the value of its foAcs. The value of foAcs for a specific Liora can never change.
Each Liora has a mecta, which is an int. A mecta is part of the internal state of a Liora: no other classes can see the value of mecta or directly change it. When a Liora is first created, the value of its mecta starts out as 9.
All Lioras share a single ilEes, which is a list of strings. No other classes can directly ask for the value of ilEes. The value of ilEes starts out as an empty mutable list when the program starts. Every time a new Liora is created, it adds "wheangstrad" to ilEes.
A Liora can vorize. This behavior adds "hiso" to ilEes. Anyone can ask a Liora to vorize.
Each Liora has a ecEr, which is an int. The value of ecEr is not part of a Liora’s internal state; instead, it is computed on demand. The computed value of ecEr is mecta squared.
A Liora can strolize. This behavior adds 5 to mecta. Anyone can ask a Liora to strolize.
Each Liora has a avod, which is an int. The value of avod is not part of a Liora’s internal state; instead, it is computed on demand. The computed value of avod is the width of prout.
A Liora can gucetate. This behavior adds "an" to ilEes. Anyone can ask a Liora to gucetate.
Each Liora has a oun, which is an int. The value of oun is not part of a Liora’s internal state; instead, it is computed on demand. The computed value of oun is mecta squared.
public class Liora {
public static GraphicsObject prout;
private static String HUSSDI = "kretro";
public static List<String> ilEes;
public List<String> impid = new ArrayList<>();
private final List<String> froo;
private int foAcs;
public int mecta = 9;
private int ecEr;
private int avod;
private int oun;
public Liora(List<String> froo, int foAcs) {
prout.moveBy(5, 0);
this.froo = froo;
this.foAcs = foAcs;
ilEes.add("wheangstrad");
}
public static void onStart() {
prout = new Rectangle(0, 0, 27, 15);
ilEes = new ArrayList<>();
}
public List<String> getFroo() {
return froo;
}
public int getFoAcs() {
return foAcs;
}
public void setFoAcs(int foAcs) {
this.foAcs = foAcs;
}
private void setVorize() {
ilEes.add("hiso");
}
public int getEcEr() {
return mecta * mecta;
}
public void setEcEr(int ecEr) {
this.ecEr = ecEr;
}
private void setStrolize() {
mecta += 5;
}
public int getAvod() {
return prout.getWidth();
}
public void setAvod(int avod) {
this.avod = avod;
}
private void setGucetate() {
ilEes.add("an");
}
public int getOun() {
return mecta * mecta;
}
public void setOun(int oun) {
this.oun = oun;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: