Probabiltiy on expect value and variance?

There are two technology development projects A, B. If pursue separately A, B will cost 0.5 million and 0.7 million respectively. The project manager estimated that probabilities of sucess for A and B are 0.7 and 0.5 respectively. If successful, the profit from A, B will be 2 million and 2.5 million, respectively. There will be no profit if they fail. The net profit equals profit minus cost.

What is the total expected net profit from project A and B?

Answer is 2 x 0.7-0.5 + 2.5 x 0.5 -0.7 = 1.45

What is the variance of net profit for B

Answer is (1.8 - 0.55)^2 x 0.5 + (-0.7 - 0.55)^2 x 0.5 = 1.5625

Please can someone tell me how you get to those answers in detail and clearly.