Nov 2nd, 2014
Price: $90 USD

Question description

(The Rectangle class ) Following the example of the Circle class  in Section 8.2, design a class  named  Rectangle to represent a rectangle. The class  contains: ■ Two double  data fields named  width and height that specify the width and height of the rectangle. The default  values  are 1 for both width and height. ■ A no-arg constructor  that creates a default  rectangle. ■ A constructor  that creates a rectangle with the specified width and height. ■ A method  named  getArea() that returns the area of this rectangle. A method  named  getPerimeter() that returns the perimeter. Draw the UML diagram for the class  and then implement the class . Write a test program  that creates two Rectangle objects —one with width 4 and height 40 and the other with width 3.5 and height 35.9. Display the width, height, area, and perimeter of each rectangle in this order.

Tutor Answer

(Top Tutor) Daniel C.
School: UT Austin

Studypool has helped 1,244,100 students

Review from our student for this Answer

Nov 5th, 2014
"Awesome! Exactly what I wanted."
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1821 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors