Question: Define a Jara class Rectangle that has the following specifications: private instance variables: mark each ) length: of type int width of type int Methods:
Define a Jara class Rectangle that has the following specifications:
private instance variables: mark each
length: of type int
width of type int
Methods:
No argument constructor a constructor to initialize the instantiated object with default values. makk
Fullparameterised constructor: a constructor to initialize the instantiated objects with parameters. mark
SerLength xx: acts as the set method for the attribute length. mark
serWidth : acts as the set method for the attribute width. mark
getLength : acts as the get method for the attribute length. mark
getWith : acts as the get method for the attribute width. mark
area: retums the area of the rectangle. Arealength width mark
Define a Jara class Test Rectangle that contains a main method and test the functionality of the aboreclass Rectangle as the following:
Ask user to enter length and width of a rectangel and use it to create an object of Rectangle rect using fullparameterized constrctor: mark
Create another object Rectangle using default constrictor rect mark
Change the length and width of rect to and mark
Print the information of the two objects rectand rect in the following format: mark length: width: area: 'ength: width: area:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
