Hi, I'm in my first programming class and I'm having some trouble with part of this assignment. We have to construct concentric rectangles and take the area of the path between then (just subtract the larger from the smaller areas), and then take the diagonals of the rectangles. I have them constructed, but I'm not sure of the syntax for the math operations. Here is the code I have so far.
public static void main (
String[] args) {
Rectangle box = new Rectangle(45,55,100,80);
Rectangle box2 = new Rectangle ((int) box.getX()+10, (int)box.getY()+10, (int)box.getWidth()-20, (int) box.getHeight()-20);
System.out.printf("The coordinates of the bigger rectangle are: {(%.0f,%.0f), (%.0f,%.0f),(%.0f,%.0f), (%.0f,%.0f)}%n",
box.getX(), box.getY(), box.getX()+box.getWidth(), box.getY(),
box.getX()+box.getWidth(), box.getY()+box.getHeight(),
box.getX(), box.getY()+box.getHeight());
System.out.printf("The coordinates of the smaller rectangle are: {(%.0f,%.0f), (%.0f,%.0f),(%.0f,%.0f), (%.0f,%.0f)}%n",
box2.getX(), box2.getY(), box2.getX()+box2.getWidth(), box2.getY(),
box2.getX()+box2.getWidth(), box2.getY()+box2.getHeight(),
box2.getX(), box2.getY()+box2.getHeight());
Any help would be appreciated, thanks!