------------------------------------------------------------------ ReviewAnalysisTester.java ------------------------------------------------------------------ import java.util.ArrayList; /** * Tests the ReviewAnalysis methods * getAverageRating() and collectComments() * that your write for 2022 FRQ 3 * * @author Joshua N * @version 18 May 2025 */ public class ReviewAnalysisTester { public static void main(String[] args) { Review r1 = new Review(4, "Good! Thx."); Review r2 = new Review(2, "OK site."); Review r3 = new Review(5, "Great!"); Review r4 = new Review(3, "Poor! Bad."); Review r5 = new Review(2, ""); Review[] reviews = {r1, r2, r3, r4, r5}; ReviewAnalysis analysis = new ReviewAnalysis(reviews); System.out.println("Tests the ReviewAnalysis methods \n" + "getAverageRating() and collectComments()\n" + "that your write for 2022 FRQ 3" ); double average = analysis.getAverageRating(); System.out.println("\nPart (a): getAverageRating() returns: " + average + " \n(Should be 3.2)\n"); ArrayList collected = analysis.collectComments(); System.out.println("\nPart (b): collectComments() returns: \n"); if (collected != null ) for (String comment : collected) System.out.println(comment); else System.out.println("null"); System.out.println ( "\nShould be: \n0-Good! Thx. \n2-Great! \n" +"3-Poor! Bad." ); } } ---------------------------------------------------------------------------- ReviewAnalysis.java ---------------------------------------------------------------------------- import java.util.ArrayList; public class ReviewAnalysis { /** All user reviews to be included in this analysis */ private Review[] allReviews; /** Initializes allReviews to contain all the Review objects to be analyzed */ public ReviewAnalysis(Review[] reviews) { /* implementation not shown */ allReviews = reviews; } /** Returns a double representing the average rating of all the Review objects to be * analyzed, as described in part (a) * Precondition: allReviews contains at least one Review. * No element of allReviews is null. */ public double getAverageRating() { /* place your code for part (a) here */ return -1; } /** Returns an ArrayList of String objects containing formatted versions of * selected user comments, as described in part (b) * Precondition: allReviews contains at least one Review. * No element of allReviews is null. * Postcondition: allReviews is unchanged. */ public ArrayList collectComments() { /* place your code for part (b) here */ return null; } } ---------------------------------------------------------------------- Review.java ---------------------------------------------------------------------- public class Review { private int rating; private String comment; /** Precondition: r >= 0 * c is not null. */ public Review(int r, String c) { rating = r; comment = c; } public int getRating() { return rating; } public String getComment() { return comment; } } ----------------------------------------