Question: in java start UML Violet UML Editor. Open a Class Diagram Add a class diagram: add a class name ( Name ) , the design
in java start UML Violet UML Editor.
Open a Class Diagram
Add a class diagram: add a class name Name the design of its instancestatic variables Attributes and the design of its instancestatic methods Methods
Add class diagram for Rectangle, sub class of Shape. Complete diagram by adding the
instance variables and methods except the constructors
The Rectangle class will inherit all the instance variables from Shape class and have the following
instance variables:
length The length of this rectangle
width The width of this rectangle
The Rectangle class will inherit all the public methods except the constructors from Shape class and have the
following methods:
Default constructor Creates a default rectangle instance. default, a rectangle has the following
values for its fields:
name: Rectangle
length:
width:
The second constructor Given a name, a length, and a width, creates a rectangle instance with the name,
the length, and the width.
For example, new Rectangle Small rectangle
getLength Returns the length of this rectangle.
setLength Given a length, changes the length of this rectangle to the new length.
getWidth Returns the width of this rectangle.
setWidth Given a width, changes the width of this rectangle to the new width.
area Returns the area of this rectangle. originally written in the super class. It equals Compares this rectangle with some other object. This method overrides the equals
method from Shape class.
toString Represents this rectangle as a string literal. This method overrides the toString method from the Shape class.
Add a class diagram for Circle, a sub class of Shape. add the following instance variables and methods except the constructors.
The Circle class will inherit name from the Shape class and have the following:
radius The radius of this circle
The Circle class will inherit all public methods except the constructors from the Shape class and have the
following additional methods:
Default constructor Creates a default circle instance. By default, a circle has the following values for its
fields:
name: Circle
radius:
The second constructor Given a name and a radius, creates a circle instance with the name and the radius.
For example, new Circle Big circle of radius of
getRadius Returns the radius of this circle.
setRadius Given a radius, changes the radius of this circle to the new radius.
area Returns the area of this circle
equals Compares this circle with some other object. This method overrides the equals
method from the Shape class.
toString Represents this circle as a string literal. This method overrides the toString method
from the Shape class.
Add a class diagram for Triangle, a sub class of Shape. Complete the diagram by adding the following
instance variables and methods except the constructors.
The Triangle class will inherit name from the Shape class and have the following additional instance variables:
sideOne The first side of this triangle
sideTwo The second side of this triangle
sideThree The third side of this triangle
The Triangle class will inherit all public methods except the constructors from the Shape class and have the
following methods:
Method Description
Default constructor Creates a default triangle instance. By default, a triangle has the following values for
its fields:
name: Triangle
sideOne:
sideTwo:
sideThree:
The second constructor Given a name and three sides, creates a triangle instance with the name and the
sides. For example, new Triangle Right Triangle
In a triangle, the sum of any two sides is greater than the third side. Class Triangle
must adhere to this rule.
getSideOne Returns the first side of this triangle.
setSideOne Given a side, changes the first side of this triangle if the new side will form a triangle
with the other two sides. Otherwise, an InvalidTriangleException object with a proper
message should be thrown.
getSideTwo Returns the second side of this triangle.
setSideTwo Given a side, changes the side two of this triangle if the new side will form a triangle
with the other two sides. Otherwise, an InvalidTriangleException object with getSideThree Returns the third side of this triangle.
setSideThree Given a side, changes the side three of this triangle if the new side will form a triangle
with the other two sides. Otherwise, an InvalidTriangleException object with a proper
message should be thrown.
area Returns the area of this triangle. This method is originally written in Shape class. It is
implemented to return the area of this triangle.
Ass as bs c
equals Compares this triangle with some other object. overrides the equals
method from the Shape class.
toString a string literal. verrides the toString method from shape class. Add a class diagram for InvalidTriangleException, on which Triangle depends only need class name. WRITE SOURCE CODE!! Make sure the UML class diagram is resaved or moved in package under src
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
