Implemented the algoritm for changing price.