{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

User - public String getSurname Get the number of entries...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.*; import java.util.Scanner; /* A User class represent one user in the system. */ public class User { private String m_username; private String m_givenName; private String m_surname; private int[] m_ratings; /* Create a new User object. * * @param givenName The user's given name, e.g. Alice. * @param surname The user's surname, e.g. Smith. * @param username The user's usernam, e.g. asmith. * @param ratings An array that contains all ratings by the user. */ public User(String givenName, String surname, String username, int[] ratings) { } /* Enable usage of the User class everywhere a String is usable. */ @Override public String toString() { } /* Get the user's username. */ public String getUsername() { } /* Get the user's given name. */ public String getGivenName() { } /* Get the user's surname.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: */ public String getSurname() { } /* Get the number of entries in the user's ratings vector which are nonzero. */ public int getNumRatings() { } /* Get the number of entries in the user's ratings vector which are zero. */ public int getNumUnrated() { } /* Get the user's rating for the ith movie in the vector. */ public int getRating(int i) { } /* Get the average of the user's rating across all movies for which the user * has a non-zero rating. */ public double getAverageRating() { } /* Return a number between 0 and 1 that describes how similar two users are, * with a user's similiarity to herself being 1. * * @param other The user to which we are comparing. */ public double similarityTo(User other) { } }...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern