Question: 9. 9.4 using interfaces for Callbacks 383 Rectangle Rectangle interface DataSet Figure s UML Diagram of the DataSet class and the Measurer Interface The data
9.
9.4 using interfaces for Callbacks 383 Rectangle Rectangle interface DataSet Figure s UML Diagram of the DataSet class and the Measurer Interface The data set will ask the RectangleMeasurer object to measure the words, the data set uses the RectangleMeasurer object to carry rectangles. As Figure 5 shows the U diagram of the classes and interfaces of this solution. in Figure 2, the Dataset class is d from the Rectangle class whose objects However, unlike in Figure 2, the class is with another class. Instead, to process rectangles, you provide a small-b elper" class measure easure This helper class has only one purposes to tell the Dataset how its objects. easurerjava 2 Describes any class whose objects can measure other ob 4 public interface Measurer Computes the measure of an object. Gparan anobject the object to be measured are turn the measure 10 double measure (0bject anobject) 12 ch09/measure2/RectangleMeasurer,java l import java art.Rectangle; 4 Objects of this class measure rectangles by area. 6 public class RectangleMeasurer inplenents Measurer 8 public double measure(object anobject) Rectangle a Rectangle (Rectangle) an0bject double area aRectangle getwidtho aRectangle.getHeightoi 12 13
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
