Refactored attribute-setting method: replaced price= with attr_accessor for writing and reading the price attribute