Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1.Fix the issues that are preventing the code from compiling(JAVA 1.8). /* * The square class models a square with a length and color. */
1.Fix the issues that are preventing the code from compiling(JAVA 1.8). /* * The square class models a square with a length and color. */ public class Square { // Save as "Square.java" // private instance variable, not accessible from outside this class private double length; private String color; // The default constructor with no argument. // It sets the length and color to their default value. public square() { length = 1.0; color = "red"; // 2nd constructor with given length, but color default public square(double r) { length = r; color = "red" } // A public method for retrieving the length public double getlength() { return length; } // A public method for computing the area of square public double getArea() { return length*length; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started