Java Assignment Help | Online Homework

Added on - 18 Sep 2019

Trusted by 2+ million users,
1000+ happy students everyday
Showing pages 1 to 4 of 13 pages
Rating.javapublic class Rating {private int userId;private int itemId;private int value;public Rating(int userId, int itemId, int value) {this.userId = userId;this.itemId = itemId;this.value = value;}public int getUserId() {return userId;}public int getItemId() {return itemId;}
public int getValue() {return value;}}RatingManager.javaimport;import;import java.util.Arrays;import java.util.LinkedList;import java.util.Scanner;import java.util.StringTokenizer;import java.util.logging.Level;import java.util.logging.Logger;public class RatingManager {private static int i = -1;private static Rating ratingAr[];
public static void main(String args[]) {ratingAr = new Rating[100000];String fileName = "src/ratings.txt";RatingManager rm = read(fileName);int itemID = 1827;System.out.println("Item rating for "+itemID);int rating[] = rm.getItemRatings(itemID);for(int r: rating){if(r == 0) break;System.out.print(r+", ");}System.out.println("\n");System.out.println("Average rating for "+itemID);double avgRating = rm.getAverageItemRating(itemID);System.out.print(avgRating+"\n\n");int userID = 6393;System.out.println("Average rating for user "+userID);double avgUserRating = rm.getAverageUserRating(userID);
Desklib Logo
You are reading a preview
Upload your documents to download or

Become a Desklib member to get access