The Appl class uses Square objects. Apply the "field encapsulation" technique to the fields in the Square class and change the existing code. Please suggest other solutions to improve code quality.
I got such a task at the interview. Such a code can satisfy the interviewer?
public class Square { private double x, y; private double width; public double getX() { return x; } public void setX(double x) { this.x = x; } public double getY() { return y; } public void setY(double y) { this.y = y; } public double getWidth() { return width; } public void setWidth(double width) { this.width = width; } public Square() { } public Square(double x, double y, double width) { this.x = x; this.y = y; this.width = width; } public double getPerimetr() { return 4*width; } } public class Appl { public void work() { Square square = new Square(); square.setX(2); square.setY(3); } }