How to find earnings, expected earnings and stock?

I am doing a study problem and I would like to know if my answers look fine.

$$X$$ is a random variable that represents the demand for a product with the following density function: $$f(x) = \frac1{e^x} ,\ x > 0$$

$$c > 0$$ is the number of units in stock

$$ax$$ are the earnings for $$x$$ units sold

$$b(c-x)$$ is the loss caused by the unsold units

1) Find the earnings as a function of $$X$$ and $$c$$

My answer: $$W = aX - b(c - X)$$

2) What are the expected earnings?

To get this answer I assumed that $$X$$ is a continuous random variable. My answer: $$E[X] = 1$$ $$E[W] = a - b(-1 + c)$$

3) What is the value of $$c$$ that maximizes the expected earnings?

My answer: $$c = E[X]$$

• Isn´t $\mathbb E(aX-bc+bX)=a-bc\color{red}+b$? The rest looks fine. – callculus May 23 at 20:24
• @callculus Thank you, you are right. – Lollipop May 23 at 20:51
• You´re welcome. In general it was a good job. – callculus May 23 at 20:55