using switch to determine cost