Create the logic for an application that instantiates a


Problem

Complete the following tasks:

a. Design a class named Square with fields that hold the length of a side, the length of the perimeter, and the area. Include a constructor that sets the length of a side to 1. Include get methods for each field, but include a set method only for the length of a side, and do not allow a side to be zero or negative. When the side is set, calculate the perimeter length (four times the side length) and the area (a side squared). Create the class diagram and write the pseudocode that defines the class.

b. Design an application that declares two Squares. Set the side length of one manually, but allow the other to use the default value supplied by the constructor. Then, display each Square's values.

c. Create a child class named Cube. Cube contains an additional data field named depth, and a compute Surface Area() method that overrides the parent method appropriately for a cube.

d. Create the logic for an application that instantiates a Square object and a Cube object and displays the surface areas of both objects.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Create the logic for an application that instantiates a
Reference No:- TGS02648734

Expected delivery within 24 Hours