Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assume the existence of an interface, GUIComponent with the following methods: - open and close no parameters, returns boolean - move and resize accepts two
Assume the existence of an interface, GUIComponent with the following methods:
open and closeno parameters, returns boolean
move and resizeaccepts two int parameters and returns void.
Define a public class, Window, that implements the GUIComponent interface, and has the following members:
int instance variables named width, height, xPos, and yPos, with xPos and yPos initialized to
a constructor that accepts two integer variables width followed by height which are used to initialize the width and height instance variables
an implementation of the open method that sends "Window opened" to System.out, and returns true
an implementation of the close method that sends "Window closed" to System.out, and returns true
an implementation of the resize method that modifies the width and height variables to the specified width and height
an implementation of the move method that modifies xPos and yPos to reflect the new position.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started