Home / Expert Answers / Computer Science / nbsp-in-coral-pseudocode-please-nbsp-complete-the-following-tasks-1-design-a-class-diagr-pa577

(Solved):   IN CORAL PSEUDOCODE PLEASE!   Complete the following tasks: 1. Design a class diagr ...



 

IN CORAL PSEUDOCODE PLEASE!

 

Complete the following tasks:
1. Design a class diagram and pseudocode class for the parent class called Square
- Attributes

Complete the following tasks: 1. Design a class diagram and pseudocode class for the parent class called Square - Attributes include: side, area, and perimeter. - Include a constructor that sets the side to 1. - Include get methods for each attribute, but include a set method only for the side. - When the side is set, do not allow it to be zero or a negative number. - When the side is set, calculate the attributes perimeter (four times the side) and area (the side times side). 2. Design a class diagram and pseudocode class for the child class called Rectangle that inherits the same attributes as Square - Additional attributes include: long side - Include a constructor that sets the parent side to 1 and the long side to 2 - Include get methods for all new attributes - Include set methods for the long side - When the side is set, do not allow it to be zero or a negative number. - When the long side is set, it cannot be the same value as the side attribute - When the side is set calculate the attribute perimeter and area - Override the calculation methods for the perimeter and area - The perimeter is (two times the side plus 2 times the long side - The area is the side times long side Exercise 2 Design a pseudocode application that declares two Square objects and two Rectangle object then does the following: 1. Declare one Square and one Rectangle object to use the values set as part of the default constructor - Do not use the set methods to modify any values - Output the values for each of the two objects 2. Declare a new set of objects using the Square and Rectangle classes but set custom values for the sides - Use the set methods to modify the side or long side of the objects to values of your choosing other than the default values - Output the values for each of the two objects


We have an Answer from Expert

View Expert Answer

Expert Answer


Code: Screenshot: Explanation: Declare a class Square and its three private attributes, side, area, and perimeter. Make a constructor and set all values to 1. Likewise, d
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe