Question: Problem Description: Create an abstract class called Shape to store information about a shape. Each shape contains the figure type and a method to calculate
Problem Description:
Create an abstract class called Shape to store information about a shape. Each shape contains the figure type and a method to calculate the area. Create sub-classes of Shape called Square and Circle. Note: That radius, sides, and areas can be decimals.
Files
ShapeMain.java
Shape.java
Square.java
Circle.java
Shape Main Class
Use the main class for testing. You won't be graded on your main class other than it must exist.
Shape Class
Build the Shape class with the following specifications:
Must be abstract
Public abstract getArea()
Square Class
Build the Square class with the following specifications:
Subclass of Shape
Public setSide()
Public getSide()
Implements getArea() correctly
Ex: Using setSide(5) results in getArea() return 10. Area = side*side
Circle Class
Build the Circle class with the following specifications:
Subclass of Shape
Public setRadius()
Public getRadius()
Implements getArea() correctly
Ex: Using setRadius(5) results in getArea() return 10. Area = PI*(R^2). Hint use Math.PI
Deliverables:
Square.java
Shape.java
ShapeMain.java
Circle.java
You must submit these file(s)
Compile command
javac Square.java Shape.java ShapeMain.java Circle.java -Xlint:all -encoding utf-8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
