Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Rectangle Class Draw the UML diagram for the class and then implement the class. Make sure that your constructors and mutator methods can check the
Rectangle Class Draw the UML diagram for the class and then implement the class. Make sure that your constructors and mutator methods can check the new length and width to make sure onl y positive values can be used in your rectangle objects, otherwise print out error message to the user Create your own project in Eclipse, add a test class with main method as usual first. Then add another new class called Rectangle without the main method in the same project. Now you should have two class files in your project. Implement the Rectangle class first. In your test class main method, creates two Rectangle objects- one with width 4 and length 40 and the other with width 3.5 and length 35.9. Display the width, length, area, and perimeter of each rectangle in this order. Bonus: Please add a class called Cube to present a cube to your project. The class contains: . Three private double variables, length, width, and height .A no-arg constructor that creates a default cube A constructor with three parameters that creates a cube with specific length, width, and height The accessors and mutators methods . A method to compute the area of the cube define at least two cube objects in your test program and use all the methods that you define in your Cube class
Rectangle Class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started