Google Interview Question

The first problem is to sort an array. The second is to write a whole class to react according to the different inputs from user interface.