Question: Add code to your MoveTesterModified lab assignment to compute and print rectangle area. Also print the expected answer. Name the class AreaTester. Submit code and

Add code to your MoveTesterModified lab assignment to compute and print rectangle area. Also print the expected answer. Name the class AreaTester. Submit code and output screenshot.

Note: Use getWidth() and getHeight() methods to get width and height.

import java.awt.Rectangle;

public class MoveTester { public static void main(String[] args) { Rectangle box = new Rectangle(5, 10, 20, 30);

// Change the width of the box to 30 and change the height of the box to 50 by using the following method. box.setSize(30, 50);

// Print information about the moved rectangle System.out.print("x: "); System.out.println(box.getX()); System.out.println("Expected: 30.0");

System.out.print("y: "); System.out.println(box.getY()); System.out.println("Expected: 50.0"); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!