Adding up values from repeated input fields

I want to add the values from the repeated input fields and display that number in a text box. I feel like the solution is in this thread Accessing value from repeated input field but I need more details because I’m not quite getting it (also that thread is old so there may be a better way altogether now).

Any help would be great, thanks.