What is the output of the following code?public class Rectangle{ // Instance variables private double length; private double width; // Getters and setters for length and width public double getLength(){ return length; } public void setLength(double length){ this.length = checkData(length); } public double getWidth(){ return width; } public void setWidth(double width){ this.width = checkData(width); } // Constructor public Rectangle(double length, double width){ this.length = checkData(length); this.width = checkData(width); } // Error-checking method public double checkData(double val){ // If value is negative, make it positive if(val < 0) val = val * -1; return val; } public double getArea(){ return length * width; } public double getPerimeter(){ return 2 * (length + width); } public

String getData(){ return "Length: " + this.length + "\nWidth: " + this.width + "\nArea: " + this.getArea() + "\nPerimeter: " + this.getPerimeter(); }}public class MakeRectangles{ public static void main(String[] args){ Rectangle rect1 = new Rectangle(-4.0, 2.0); Rectangle rect2 = new Rectangle(8.0, 6.0); System.out.println("Rectangle 1:\n" + rect1.getData()); System.out.println("Rectangle 2:\n" + rect2.getData()); }}

A. Rectangle 1:
Length: 4.0
Width: 2.0
Area: 8.0
Perimeter: 12.0
Rectangle 2:
Length: 8.0
Width: 6.0
Area: 48.0
Perimeter: 28.0
B. Rectangle 1:
Length: -4.0
Width: 2.0
Area: -8.0
Perimeter: -12.0
Rectangle 2:
Length: 8.0
Width: 6.0
Area: 48.0
Perimeter: 28.0
C. Rectangle 1:
Length: -4.0
Width: 2.0
Area: -8.0
Perimeter: -4.0
Rectangle 2:
Length: 8.0
Width: 6.0
Area: 48.0
Perimeter: 28.0
D. Rectangle 1:
Length: -4.0
Width: 2.0
Area: 8.0
Perimeter: 12.0
Rectangle 2:
Length: 8.0
Width: 6.0
Area: 48.0
Perimeter: 28.0

Answer: A

Computer Science & Information Technology

You might also like to view...

A characteristic rule is a rule of the form {p} ?? {q1, q2,...,qn}, where the rule antecedent contains only a single item. An itemset of size k can produce up to k characteristic rules. Let ? be the minimum confidence of all characteristic rules generated from a given itemset: Is ? monotone, anti-monotone, or non-monotone?



For each of the following measures, determine whether it is monotone, anti-

monotone, or non-monotone (i.e., neither monotone nor anti-monotone).

Computer Science & Information Technology

Where can you find a list of MySQL commands you have previously run?

What will be an ideal response?

Computer Science & Information Technology