-
Implementations!
Assume the existence of an interface, GUIComponent with the following methods: - open and close: no parameters, returns boolean - move and resize: accepts two integer parameters and returns void
Define a class, Window, that implements the GUIComponent interface, and has the following members: - width, height, xPos, and yPos integer instance variables, with xPos and yPos initialized to 0 - a constructor that accepts two integer variables (width followed by height) which are used ti initialize the width and height instance variables - An implementation of open: that sends "Window opened" to System.out, and returns true - An implementation of close that sends "Window closed" to System.out, and returns true - An implementation of resize that modifies the width and height variables to reflect the specified size - An implementation of move that modifies xPos and yPos to reflect the new position.
this is what i have:
public class Window implements GUIComponent{
private int width;
private int height;
private int xPos = 0;
private int yPos = 0;
public Window(int width, int height){
width=num1;
height=num2;
{
public boolean open(){
System.out.println("Window opened")
return true;
}
public boolean close(){
System.out.println("Window closed")
return true;
}
public void resize(){
int width=x
int height=y
return void;
}
public void move(){
int xPos=3
int yPos =4
return void;
}
}
}
}
-
Re: Implementations!
Do you have a question?
Please Edit your post and wrap your code with
[code=java]
<YOUR CODE HERE>
[/code]
to get highlighting and preserve formatting.
-
Re: Implementations!
the question is at the top, my answer is at the bottom. after the bold.
-
Re: Implementations!
Sorry, I don't see your question. All I see is what looks like your assignment. I'm looking for something that ends with a ?
If you have any specific questions about your assignment, ask them.
Please Edit your post and wrap your code with
[code=java]
<YOUR CODE HERE>
[/code]
to get highlighting and preserve formatting.
-
Re: Implementations!
Does your code compile? You'll have to write the interface code as well to find out.
If it doesn't compile and you can't understand why, post the full compiler message and say what lines of your code it is referring to.