Homework for C++ and Java