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
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.


We have an Answer from Expert

View Expert Answer

Expert Answer


You should save the below code as Window.java // Window.java public clas
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe