Methods: Identifier: getxposition0 Parameters Return Value: int-The x coordinate
ID: 3835217 • Letter: M
Question
Methods: Identifier: getxposition0 Parameters Return Value: int-The x coordinate of the GameQbiect Other: getYPositionQ Identifier: Parameters Return Value: int-The y coordinate of the GameQbiect Other: Identifier Color 0 Parameters Return Value: Color -The color of the GameQbiect Other: setXPosition Grat Position Identifier Parameters Lxposition An int type representing the x coordinate of the GameQbiect Return Value Other: SetYPositionintvPosition Identifier Parameters VPosition-An int type representing they coordinate ofthe GameObiectExplanation / Answer
import java.io.*;
import java.util.*;
import java.awt.Color;
//class GameObject
class GameObject{
//Data members
private int x;
private int y;
private Color color;
//getXPosition() method definition
public int getXPosition(){
return x;
}
//getYPosition() method definition
public int getYPosition(){
return y;
}
//getColor() method definition
public Color getColor(){
return color;
}
//setXPosition() method definition
public void setXPosition(int xPosition){
x = xPosition;
}
//setYPosition() method definition
public void setYPosition(int yPosition){
y = yPosition;
}
}