Partial Solution P29.java.