. For this problem, you will implement a complete class called Rectangle which represents a rectangle. Here are the specifications: Instance Variables: The class has two instance variables.
length: an int representing the length of the rectangle.
width: an int representing the width of the rectangle.
Methods you must implement:
Constructor: Define a constructor that takes two parameters (length and width) and initializes the instance variables accordingly.
Accessor methods (get methods): These methods should let accessing length and width.
area: This method should return the area of the rectangle.
merge: This method takes a Rectangle type parameter. The method will create a new Rectangle object whose length is the sum of length of the calling object and the length of the parameter. Similarly, the width of the new Rectangle object is the sum of width of the calling object and the width of the parameter. A reference to the new Rectangle object should be returned. The calling object and the parameter object should not be modified.
toString: Write the toString method associated with this class. The returned String has to be in the following form: “length : [length value here], width: [width value here]”.
totalArea: This is a static method that takes an array of Rectangles as a parameter. The method returns the sum of the areas of the rectangles in the array.
Problem 3. Implement a ColoredRectangle class which extends the Rectangle class you have defined in Problem 3. In addition to the instance variables of Rectangle, ColoredRectangle has the following instance variable:
• color: a String that represents the color associated with the rectangle.
Methods you must implement:
Constructor: Define a constructor that takes three parameters (length, width and color).
merge: This method takes a ColoredRectangle type parameter. The method will create a new ColoredRectangle object whose length is the sum of length of the calling object and the length of the parameter. Similarly, the width of the new ColoredRectangle object is the sum of width of the calling object and the width of the parameter. The color of the new ColoredRectangle object will be the color of the parameter object. A reference to the new ColoredRectangle object should be returned. The calling object and the parameter object should not be modified. YOU WILL GET 3 bonus points if you correctly call the super’s merge(…) within this method.
Is this merge method considered overriding the merge method of Rectangle? Why or why not?
• toString: Write the toString method associated with this class. The returned String has to be in the following form: “length : [length value here], width: [width value here], color: [color value here] ”.
GraduateWriterHelp.com is an online academic writing platform that provides extensive assistance to graduate school students as they work through their research projects, papers and dissertations. GraduateWriterHelp.com gives students access to experienced professionals who can provide the help they need in a timely and efficient manner. The service offers a wide range of services, including editing, proofreading, formatting, researching and more that can give students the confidence they need to write the perfect paper or dissertation for their chosen subject matter.
Services Offered by GraduateWriterHelp.com
GraduateWriterHelp.com offers a wealth of different services designed to make research projects easier for graduate school students. These include editing, proofreading, formatting and researching services, all tailored specifically for graduate-level studies such as PhDs or Master’s degrees in any field from business administration to engineering or even psychology – all with the aim of helping busy students find success in their academics without having to sacrifice other important commitments like family time or work hours towards earning a living wage outside of college hours.
The Benefits of Using GraduateWriterHelp.com
Using GraduateWriterHelp.com gives you access to experts from all over the world who are highly qualified and experienced in helping graduate-level students to complete successful projects in various fields quickly and efficiently – something that would otherwise be difficult, if not impossible, given tight deadlines associated with most Ph.D./Master’s degree programs today. Moreover, using this platform makes it easier for students to keep up with multiple research tasks simultaneously since there are so many different experts available on tap at any one time – no longer will you have to put off studying one topic while focusing on another because of lack of resources! Additionally, having access to professional editors, proofreaders, but also formatters means that quality control standards aren’t sacrificed when finishing major pieces – since these individuals understand what makes up good academic writing better than anyone else and can offer guidance on how best one should go about making improvements along those lines. Finally, there is also an added cost-saving benefit associated with utilizing Graduate Writer Help compared to hiring an independent contractor (which could potentially run into thousands depending on length/complexity).
This service allows users only pay for what students need, which tends to be much lower overall because customers pay per hour rather than project basis, thus resulting to greater financial flexibility, especially for those just starting out postgraduate studies looking to conserve some pennies here there whenever possible!
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more