This is atleast of of the easy ways you can implement what you want using java. As you know java is a very powerful programming language,therefore there are other million ways one can implement this,...