Money classes so that they conform to the UML
diagram below. This means you will need to create
Writeable, and you will
also need to add the specified method to the two classes. You should not
remove any of the existing features of those classes.
Note also the following points:
Writer is a class from the Java API, defined in the
package. It represents something to which you can write text (standard
output, a file, etc).
The purpose of the
writeTo method is to write a textual representation
of an object to the given
Writer. In the case of
Money objects, if
the amount of money is 2 euros and 7 cents, the string
should be written, followed by a newline character. In the case of
objects, if the circle radius is 1.5, the string
Circle: r=1.5000 should
be written, again followed by a newline.
writeTo method can potentially throw the checked exception
IOException, so you will need to declare this fact using an exception
To help you check whether you have implemented all of this correctly,
you can use the program in
Ex10.java. If you compile and run this
program, it should generate the following output:
Money: €2.07 Money: €11.80 Circle: r=6.3952
When you are confident that your solution is working as required, go to
Submit My Work → Exercises 6-10 → Exercise 10 in Minerva to
submit the three files
You can improve your solution and resubmit as many times as you like until
the deadline. Also, don’t forget to commit all your work to your Git
repository and push those commits up to GitLab.