Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

Students also viewed these Databases questions