0

Feedback rating calculator

To calculate all the reviews given by the customer for a product and set the product rate

30th Aug 2020, 4:49 AM
Optimus Prime
Optimus Prime - avatar
3 Réponses
+ 1
Are you giving your home work to us ! We can help you to solve your errors and problems but no one will provide you code here Ok Now show me your try first
30th Aug 2020, 5:02 AM
Ayush Kumar
Ayush Kumar - avatar
0
/** * This program reads a file of movie ratings and * calculates the average rating for each using * a Hashmap. The hashmap uses the movie name as * the key and the item is an object that stores * the total ratings and number of ratings. */ import java.util.HashMap; import java.util.Set; import java.util.Scanner; import java.util.StringTokenizer; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; class RatingStats { private int numRatings, sumRatings; public RatingStats (). { numRatings = 0; sumRatings = 0; } public int getNumRatings () { return numRatings; } public int getSumRatings () { return sumRatings; } public void addRating (int rating) { numRatings ++; sumRatings + = rating; public public class Question public static void main (String [] args) { // The ratings HashMap maps from a movie name // to a RatingStats object HashMap< String, Ratingstats> ratings new HashMap< String, Rating
30th Aug 2020, 5:05 AM
Optimus Prime
Optimus Prime - avatar
- 1
/** * This program reads a file of movie ratings and * calculates the average rating for each using * a Hashmap. The hashmap uses the movie name as * the key and the item is an object that stores * the total ratings and number of ratings. */ import java.util.HashMap; import java.util.Set; import java.util.Scanner; import java.util.StringTokenizer; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; class RatingStats { private int numRatings, sumRatings; public RatingStats (). { numRatings = 0; sumRatings = 0; } public int getNumRatings () { return numRatings; } public int getSumRatings () { return sumRatings; } public void addRating (int rating) { numRatings ++; sumRatings + = rating; public public class Question public static void main (String [] args) { // The ratings HashMap maps from a movie name // to a RatingStats object HashMap< String, Ratingstats> ratings new HashMap< String, Rating
30th Aug 2020, 5:06 AM
Optimus Prime
Optimus Prime - avatar