Question
implement the given UML. You have one interface called '_Area' and one abstract class called '_Shape'. Class '_Shape' will be used as a super class.
implement the given UML. You have one interface called '_Area' and one abstract class called '_Shape'. Class '_Shape' will be used as a super class. Overide the methods toString, getArea and getName in all classes.
make a test class and . Make objects from class Rectangle , Then assign all objects to array of type _Shape, iterate over the array and call toString of each object.
The out put should be like:
Class name is Rectangle
Area =
Q- - You have an object from class _Shape, but we need to access setWidth from class rectangle, add the missing line to complete it and make sure it does not produce errors:
_Shape shape3 = new _Rectangle(8.94);
> _Area +getArea(): Double implements _Shape {abstract} - name : String + setName(String): void + getName(): String + toString(): void Extend: _Rectangle - width : Double - height: Double constructor _Rectangle(Double : w) constructor _Rectangle(Double :w, Double :h) + getArea(): Double + setWidth(Double : w): void + setHeight(Double :h) : void + getWidth(): Double + getHeight() : Double + to String(): voidStep 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