how can i compute the price and amount? like buy two pens, and $10 per pen, i need to compute 2 * 10
this is a bit vague in terms of what you want to do/your circumstances. Let me try something:
You have the entity pen which has a price persisted somewhere and you have an entity amount which means the amount of pen’s somewone wants to buy. Now the user sais: “I want to buy two pens!” and you want to be able to calculate the sum of this order.
If that’s the case I’d suggest a form for this, in which you are able to define different slots. If both slots are filled, the form would be submitted - that’s the method in which you could sum up the price (meaning to define a third slot for it).
Did that help?