Tessella interview question

Java exercise which was quite simple using inheritance etc.