Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Using Netbeans (or your preferred IDE), create a class called Shape using the following guide: public class Shape { private String name; public Shape(String
1. Using Netbeans (or your preferred IDE), create a class called Shape using the following guide: public class Shape { private String name; public Shape(String name) { this.name = name; /** returns the name of the shape / public String getName() { return name; /* returns the area of the shape * public double getArea() { return 0.0; public void print Dimensions(){ System.out.println("No dimensions"); 2. Create 4 additional classes as follows: Shape Equateral Triangle 3. For each additional class do the following: 1. Have a constructor that takes a name, which it turn invokes the constructor of its superclass 2. Implement a set Dimensions() method that will take the following parameters: 1. Square: length and height 2. Circle: radius 3. Triangle: 3 sides 4. Equilateral Triangle: 1 side 3. Override the printDimensions() method of the superclass to print the dimensions of the current shape. 4. Override the getArea() method of the superclass to calculate the correct area for each shape. For triangles, use Heron's Formula: area - Vs (s-a) (s-b) (s-c) where a,b, and care the lengths of the sides, and s= the perimeter 5. Create a main class that will create one instance of each class, and prompt the user to enter the dimensions for each object. 6. Once all objects have been created, print the name, dimensions, and area for each object to the screen
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