Home /
Expert Answers /
Computer Science /
written-in-java-script-please-assume-the-following-window-class-has-been-defined-public-class-windo-pa948
(Solved): written in java script please Assume the following Window class has been defined: public class Windo ...
written in java script please
Assume the following Window class has been defined: public class Window \{ private int width; private int height; private int xPos; private int ypos; public Window(int \( w \), int \( h \), int \( x \), int \( y \) ) \{ width = w; height \( =h \); xPos \( =\mathrm{x} \); yPos = \( y \); \} 11 The rest of the class is not shown... \} Write a toString method for the Window class. The toString method should return a string in the form "A widthxheight window at (xPos,yPos)" where the values shown in bold are replaced by the values of the corresponding fields. For example, suppose we create a Window object with the following statement: Window \( w= \) new Window \( (80,20,0,30) \); For this object, the tostring method should return the following string: "A \( 80 \times 20 \) window at \( (0,30) \) " Note: The string returned by your tostring method must be formatted exactly as shown above. Make sure the string does not contain extra spaces or punctuation.