/* This program contains the main method It demonstrates the Rectangle class * */ import java.util.*; public class RectangleDemo { public static void main(String[] args) { Scanner key = new Scanner(System.in); // Creates the Rectangle Object Rectangle rec = new Rectangle(); // Get the length from the user System.out.print("Enter the length: "); double len = key.nextDouble(); // Get the width from the user System.out.print("Enter the width: "); double wid = key.nextDouble(); /* Calls the setLength and setWidth methods in the Rectangle class Using the object name we created, "rec" Pass the len and wid into the methods * */ rec.setLength(len); rec.setWidth(wid); /* Outputs the length and width entered by the user In addition to that the area will be output * */ System.out.println("The length is " + rec.getLength()); System.out.println("The width is " + rec.getWidth()); System.out.println("The area is " + rec.getArea()); } }