Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

The area of the circle and triangle:

Circle Area = pi *r^2 Triangle Area = 0.5 * height * base

make a test class and . Make objects from class Circle , Triangle. 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 circle

Area =

Class name is triangle

Area=

image text in transcribed

> _Area + getArea() : Double implements Shape {abstract} - name : String + setName(String) : void + getName(): String + toString(): void Extends Extends Circle Triangle -radius: Double - base : Double - height: Double constructor Circle(r: Double) + getArea(): Double + setRadius(Double :r): void + getRadius() : Double + toString(): void constructor Triangle(Double : b, Double : h) + getArea() : Double + setBase(Double : b) : void + setHeight(Double : h) : void + getBase() : Double + getHeight(): Double + toString(): void

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_2

Step: 3

blur-text-image_3

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

Genetic Databases

Authors: Martin J. Bishop

1st Edition

0121016250, 978-0121016258

More Books

Students also viewed these Databases questions

Question

2. Clearly identify time constraints.

Answered: 1 week ago