If you have downloaded the books source code from www.pearsonhighered.com/gaddis, you will find a partially written program

Question:

If you have downloaded the book’s source code from www.pearsonhighered.com/gaddis, you will find a partially written program named AreaRectangle.java in this chapter’s source code folder. Your job is to complete the program. When it is complete, the program will ask the user to enter the width and length of a rectangle, and then display the rectangle’s area. The program calls the following methods, which have not been written:

• GetLength—This method should ask the user to enter the rectangle’s length, and then return that value as a double.

• GetWidth—This method should ask the user to enter the rectangle’s width, and then return that value as a double.

• GetArea—This method should accept the rectangle’s length and width as arguments, and return the rectangle’s area. The area is calculated by multiplying the length by the width.

• DisplayData—This method should accept the rectangle’s length, width, and area as arguments, and display them in an appropriate message on the screen. 

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: