My solution to some Java homework.
You can test the java solution with:
javac *.java && java Main
As is customary I also solved this in Haskell in opposition to OOP; you can try this with:
runhaskell Meters.hs
Go ahead- have a look at the Haskell. Consider how much nicer it is than java, and how it is about 100 times faster:
> time (for i in `seq 1 100`; do java Main > /dev/null; done)
4.79s
> time (for i in `seq 1 10000`; do ./main > /dev/null; done)
3.76s
I also solved this in 3 lines of Vim. Input/output should be JSON, as such this solves the optional task as well.