Assume the existence of a Window class with the following methods : – widen – accepts no arguments;

Assume  the existence of a Window class  with the following methods : – widen – accepts no arguments;

LANGUAGE: Java

CHALLENGE:

Assume the existence of a Window class with the following methods : – widen – accepts no arguments; doubles the width of the window – setHeight – accepts an integer argument corresponding to the new height of the Window – getWidth and getHeight – accept no arguments , return the width and height of the window respectively.

There is also a subclass, TitledWindow whose constructor accepts a width and height (bot integers ), and a title (a string ) — in that order. TitledWindow also has a method, setText that accepts a string , allowing the title of the window to be changed.

Declare a variable , tWindow, of type TitledWindow variable , and initialize it to a window with a width of 50 and a height of 75, and a title of “Rectangular Window”.

Double the width of the window, using widen, set the height of the window so that it is the same as the width, and set the title to the new value “Square Window”.

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days – Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level