How to make a calculator from an example?

I ask you to get acquainted with an example and provide an appropriate solution to the problem.

Sound more like freelancer task. Its hard to solve this by forum Q.

Anyway this is not related to interactions (More custom JS).

Overkill - but by vue.js its really easy to create such ideas:

Example i made in the past:

And all the idea of hide/show if option X is selected - ± the idea: