Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Ian Mburu
Added: Jun 10, 2021 5:34 PM
Modified: Jun 10, 2021 5:37 PM
Views: 113
Tags: java rating
  1. /**
  2.  *
  3.  * @author Ian
  4.  */
  5.  
  6. @Slf4j
  7. @Service
  8. public class AuthService {
  9.    
  10.     //rating formula - weighted average
  11.     private double getNewRank(double currentValue,short numberOfRatings, double newValue){
  12.         double total = currentValue * numberOfRatings;
  13.         total += newValue;
  14.         return total/(numberOfRatings+1);
  15.     }
  16.    
  17.    
  18. }
  19.