import java.util.ArrayList;
public class ReviewAnalysis
{
/** All user reviews to be
included in this analysis */
private Review[] allReviews;
/**Initializes allReviews to
contains all the Review objects to be analyzed.*/
//Note: This constructor was
changed a little from question to pass the data
//into the object. It won't impact the solution.
public ReviewAnalysis(Review[] reviews)
{
allReviews = reviews;
}
/**Returns a double representing
the average rating of all 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()
{
//to be implemented in part A
}
/** 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<String>
collectComments()
{
//to be implemented in part B
}
}
|