Use class abstraction and encapsulation concepts to re-draw the UML class diagram of Square class that you drew in Lab 02. Discuss: Do you think the data field (side) should be declared private...



  1. Use
    class abstraction and encapsulation
    concepts to re-draw the UML class diagram of Square class that you drew in Lab 02.


Discuss:


Do you think the data field (side) should be declared private (hidden)? Why?


If the data field is declared private (hidden), how the data field can be accessed from outside the class (for example, from the Test class)?


The new UML class diagram should include the getter and setter methods which deal with the data field side.



  1. Create a new Java Application project called
    lab_03.

  2. Copy the source files of the classes
    java
    and
    TestSquare.java
    that you created in Lab 01 and paste both source files in the default package. (you may need to fix any problems related to package declaration)

  3. Open
    Square
    and
    TestSquare
    classes using NetBeans editor.

  4. Use
    class abstraction and encapsulation
    concepts to modify the implementation of
    Square
    class, so the new class implementation would satisfy the class abstraction and encapsulation concepts.

  5. Add any required getter and setter methods to the class
    Square.

  6. Fix any compiling errors in the
    TestSquare
    class as a result of modifying the class
    Square.

  7. Run the Test
    TestSquare








Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here