Rectangle code as done in class last Monday