Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int predictRating(Film f, User u) {
- int res = 4;
- if (f == null && u != null) {
- res = (int) Math.round(u.avarageRating);
- } else {
- if (f != null && u == null) {
- res = (int) Math.round(f.avarageRating);
- } else {
- if (f != null && u != null) {
- res = (int) Math.round(Math.sqrt(f.avarageRating
- * u.avarageRating) - 0.1);
- }
- }
- }
- if (res < 1)
- res = 1;
- if (res > 5)
- res = 5;
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement