public class Good { public double price = 0.00; public String name = "New Good"; public String goodCreated(String name, double price) { // ÐеÑод ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ ÑоваÑа. this.priceSet(price); this.nameSet(name); String formattedDouble = String.format("%.2f", this.price); // Ðожно бÑло Ð±Ñ Ð²ÑнеÑÑи в оÑделÑнÑй меÑод, ÑÑÐ¾Ð±Ñ Ð±Ñло DRY, но не Ð²Ð¸Ð¶Ñ ÑмÑÑла; String goodCreated = this.name + formattedDouble; return goodCreated; } public double priceSet(double price) { this.price = price; // System.out.println("Price has set " + this.price); return this.price; } public String nameSet(String name) { this.name = name; // System.out.println("Name has set " + this.name); return this.name; } }