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

Info iconThis 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.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background 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

This note was uploaded on 11/11/2011 for the course CS 2110 taught by Professor Francis during the Spring '07 term at Cornell.

Page1 / 2

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

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online