solving perimeter and area problems