Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java class implementation Implement a Rectangle java class to create the rectangle objects and calculate the area of the rectangle objects based on the


image

Java class implementation Implement a Rectangle java class to create the rectangle objects and calculate the area of the rectangle objects based on the given UML class diagram. Please just implement the class and the tests in the example table will be executed automatically. ps. rectangle area = width*height -double width -double height +Rectangel() +Rectangel(double, double) +getArea():double +getWidth():double +getHeight():double +setWidth(double):void +setHeight(double):void For example: Rectangle Test Rectangle rec=new Rectangle(); System.out.println(rec.getArea()); Rectangle rec=new Rectangle (1.2,3.5); System.out.println(rec.getArea()); Rectangle rec=new Rectangle(-1.2,3.5); System.out.println(rec.getWidth()+" "+rec.getHeight()); Rectangle rec=new Rectangle(); rec.setWidth (3.5); rec.setHeight (-2.5); System.out.println(rec.getArea()); Answer: (penalty regime: 0 %) Reset answer 1 v public class Rectangle{ 2 3} //please add your code here Result 0.0 4.2 1.2 3.5 8.75

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Rectanglejava public class Rectangle private double width private double height public ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems analysis and design

Authors: kenneth e. kendall, julie e. kendall

8th Edition

135094909, 013608916X, 9780135094907, 978-0136089162

More Books

Students also viewed these Programming questions

Question

Outline the four basic components of drives according to Freud.

Answered: 1 week ago