Design a class named Rectangle that holds length, width and color. Create the class diagram and write the pseudocode that defines the class. The details are below: Each field (length, width & color) should only be accessible within the class (hint: use correct access modifier). Include methods to set and get the values for each field. Include an additional method to calculate and return the area (hint: this is calculated by multiplying width and height). Include two constructors One default constructor that sets the length and width to default values of 10 and the color to blue Second constructor that takes two arguments to set the length and width fields and default the color to red Design an application that declares two Rectangle objects and sets and displays their values. Design an application that declares a Rectangle object using the second constructor and then displays the object's values Design an application that declares an array of 5 Rectangle objects. Prompt the user for data for each object, and then display all the values.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Design a class named Rectangle that holds length, width and color. Create the class diagram and write the pseudocode that defines the class. The details are below: Each field (length, width & color) should only be accessible within the class (hint: use correct access modifier). Include methods to set and get the values for each field. Include an additional method to calculate and return the area (hint: this is calculated by multiplying width and height). Include two constructors One default constructor that sets the length and width to default values of 10 and the color to blue Second constructor that takes two arguments to set the length and width fields and default the color to red Design an application that declares two Rectangle objects and sets and displays their values. Design an application that declares a Rectangle object using the second constructor and then displays the object's values Design an application that declares an array of 5 Rectangle objects. Prompt the user for data for each object, and then display all the values.

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









