How can I create a star rating functionality that can serve as an input and display?

I need to create a star rating functionality that accepts reviews and display the average rating for each profile that is reviewed. Also I will like to use a dynamic text that also displays the average rating for each profile just like the star rating average display.

Finsweet’s solution is popular;