Home /
Expert Answers /
Computer Science /
please-complete-in-java-code-here-are-some-tips-for-reading-the-above-uml-static-class-diagram-an-pa572
(Solved): Please complete in Java code Here are some tips for reading the above UML static class diagram: - An ...
Please complete in Java code
Here are some tips for reading the above UML static class diagram: - An "I" in a purple circle indicates an interface. - A "C" in a green circle indicates a class. A superimposed "A" indicates that the class is abstract. - The names of abstract classes and methods are in italics. - Package names appear below interface/class names. - Solid arrows indicate a subclass-superclass relationship; a dotted arrow indicates an implementation-interface relationship. - A solid green circle indicates that a field is public; a red square means that it is private. - Constructors are marked with a " C ". - The UML does not indicate that all of the methods in Num, Fraction, and MixedNumber override superclass methods (such as tostring () and floatValue ()) or implement extract methods (such as compareTo ()).
First, implement Num. You will need to carefully read the documentation for its concrete methods in the API where they are first declared. When implementing Number's abstract methods that return whole numbers, round toward zero when converting from double. add any constructors, variables, or methods not shown in the class diagram. Next, implement Fraction and MixedNumber. The printed representation of the fraction with the numerator 1 and the denominator 2 should be "1/2" (with no space). The printed representation of the mixed number with the whole number 1 , the numerator 2 , and the denominator 3 should be "1 2/3 " (with a single space between the numbers 1 and 2 ). Finally, implement tests that show (5 pts): - Instances of each class are printed correctly. - compareTo () and equals () (which you should define in Num) work (return the right value) when comparing instances of: Fraction and Fraction Fraction and MixedNumber (in either order) MixedNumber and MixedNumber - Calling Collections. sort () on a List< < um > does the right thing.