Application of Derivative

A company manufactures chairs. It has a maximum yearly output of 500 chairs. If it makes x chairs, it can set a price of p(x)=200-.15x dollars each and will have a total yearly cost of c(x)= 4000+6x-(.001)x^2

A. What production level maximizes the total yearly profit

For this problem I did:

Profit= earnings-cost of production

P=200-.15x-4000-6x+.001x^2

dp/dx=.002x-6.15

x=3075 chairs, which is not in the domain of the problem

B. With the addition of new machine, the company could boost its yearly production of chairs to 750. However, its cost of function C(x) will then be

C(x)= 4000+6x-(.001)x^2 if 0 ≤ x ≤ 500

C(x)= 6000+6x-(.003)x^2 if 500 ≤ x ≤ 750