Wednesday, March 16, 2022

Java - What about that snippet

I liked was in the class.
And is the rating, if don't do this every new rating will replace the previous rating, Avaliacao is rating, what is in rose is the part of the code that remains of the original, the original is easy to do with the IDE, in the intelijji, you click with the right-button-mouse (that is the sensitive button of the mouse the left select and the right is all the other actions that aren't chosen, of course, that have with the left button other actions that is select, drag, double-click)inside the parenthesis of the class and with the right-mouse-button, you click and gonna appear a box with options and you gonna choice -->Generate, after you gonna choice -->Getters and Setters, and will choose to generate code about the attributes that you create for the class, so in the rating(Avaliacao), and will gonna want that every new rating be added to the next like a percentage about the all the views, you want to know the media if 12 persons see that movie, you don't want to know that the sum is 79 of rating because don't make sense because if was 200 persons the rating is very low, so yuo need an something like a perceting or proportion, so here we have a proportion is all the rates values divided by the numbers of ratings, so in the end we sum the rate of all the 12 persons that see for the number of persons that saw that is in my example 12. So now I don't need only the new evaluation that erases all the past but hold all the evaluations that will be automatically reserved in the new calculation, so I receive a rate, in the second I will get the first that all I have till that moment and sum to the 2nd rate and divide by 2, in the 3rd I will get the result of the 1st+2nd/2 and sum the 3rd and divide again for 2, but in one moment I can receive 5 rates, so for this I will sum the past that now mean 1, so I sum the ((((1st+2nd/2)+3rd)/2)+4th+5th+6th+7th+8th)/1+5.
Rute Bezerra de Menezes Gondim
Ps.: After I return to explain only the code





No comments:

Post a Comment