Someone help with this Java problem?


#1

/**
* Computes the number of stars for a given rating to the nearest half star. This is
* equivalent to rounding the input to the nearest 0.5. For example, a something with
* a rating of 3.34 would have a star rating of 3.5 stars.
*
* @param rating An average rating as a double in the range of 1.0-5.0 inclusive
* @return The star rating of the input rating
*/
public double starRating(double rating){

I need a formula to calculate starRating. I dont know how to put it in such a way that if a rating exists, it should round to the nearest .5, which would be my starRating


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.