Artem H.

asked • 05/07/21

Here is a UML diagram for a geometric figure, the Square. Use this diagram to write a class called Square.java that contains the instance variables and instance methods given below:

Here is a UML diagram for a geometric figure, the Square. Use this diagram to write a class called Square.java that contains

the instance variables and instance methods given below:

                             Square  
-side: int
+Square() //default constructor set size to zero +Square(int newSide) // regular constructor sets side to newSide +getSide():int // returns current value of side +setSide(int newSide) // changes value of side to new Side +getArea():double // returns area of the square (square of the sides) +isSame(Square other):Boolean // returns true if square is same as other,                                                           // returns false otherwise +toString(): String // returns the string representation of square as                                 // “Square of side length s” where s is the integer value of side                                 // for example, if side ==6, then returns “Square of side length 6”


1 Expert Answer

By:

Patrick B. answered • 05/08/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.