Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public abstract class Shape { public abstract double area(); public abstract double perimeter): } a. You wish to use this abstract class and use it
public abstract class Shape { public abstract double area(); public abstract double perimeter): } a. You wish to use this abstract class and use it to generate a class Square. This class should contain an integer instance variable side. This variable must be initialized by a constructor to the integer value 6. Then the area must be calculated as side and the perimeter must be calculated as 4*side. Finally the area and the perimeter must be printed. b. Write a class TestSquare that makes the needed initializations and prints the following output Square side: 6 Resulting area: 36 Resulting perimeter: 24 c. Given the following program segment: public class Mystery { public static void main(String [] args) { int x = 5: double y = x int zu System.out.println(" x = "+x+"y="+y+" z= "+z); }//end main }// end class Is there an error? If so, correct it and give the output
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