More Chapter 1 Solutions in Java