This is your problem, you can't have methods within a method.
But this was due to you not closing your brackets for your methods.
I fixed your code and added the methods you wanted:
public class MyRectangle {
//Best to group your variables up here
public int MyRectangle;
public int width;
public int height;
public int y;
public int x;
public MyRectangle() {
width = 10;
height = 10;
y = 10;
x = 10;
}//Make sure to close this method with the bracket
public MyRectangle(int width, int height, int y, int x, int MyRectangle) {
this.width = width;
this.height = height;
this.y = y;
this.x = x;
this.MyRectangle = MyRectangle;
}
/**
* Changes the current height to the given new height
* @param newHeight
*/
public final void changeHeight(int newHeight) {
height = newHeight;
}
/**
* Changes the current width to the given new width
* @param newWidth
*/
public final void changeWidth (int newWidth) {
width = newWidth;
}
/**
* Calculates the current perimeter based on the width and height
* @return parameter ofd the rectangle
*/
public final int getPerimeter() {
return ((2 * width) + (2 * height));
}
/**
* Calculates the area based on the width and height
* @return area of the rectangle
*/
public final int getArea() {
return (width * height);
}
public final void changesXCoordinate(int newX){
x = newX;
}
public final void changesYCoordinate(int newY){
y = newY;
}
public final void changesCoordinate(int newX, int newY) {
x = newX;
y = newY;
}
}
I will explain more soon, just wanted to post the correct code first :P
As it stands, it's kinda hard to understand what else you are looking for.
If this is what you are looking for, please mark this as the correct answer :D