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 Threpross.
All Threprosss share a single smaod, which is an int. No other classes can directly ask for the value of smaod. The value of smaod starts out as 19 when the program starts. Every time a new Threpross is created, it adds 6 to smaod.
public class Threpross {
public static int smaod;
public Threpross() {
smaod += 6;
}
public static void onStart() {
smaod = 19;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: