homework with all methods working