Question: Write a class called Rectangle that contains two data fields- length (type double), and width (type double). Your class should have a constructor that initializes

 Write a class called Rectangle that contains two data fields- length

Write a class called Rectangle that contains two data fields- length (type double), and width (type double). Your class should have a constructor that initializes the two instance variables. Provide a set and a get method for each instance variable. In addition provide a method named computeArea() that calculates the area of rectangle (i.e. multiplies length by width), then return the area as a double value. Write a test application named RectangleTest that demonstrates class Rectangle's capabilities. Create two Rectangle objects and display the Area for each Rectangle. Put your QUID and name as comments at the top of your code. lution

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!