Untitled
unknown
plain_text
5 years ago
1.3 kB
9
Indexable
* CONSTRUCTOR - VERY IMPORTANT!!!
* (make instance copies of the parameters into corresponding instance variables)
* WEEK 4 LECTURE COVERS EVERYTHING NEEDED FOR THE CONSTRUCTOR
* @param title
* @param views
*/
public VideoAnalytics(String _title, int[] _views) {
// make a new instance by(the value of _title)
this.title=new String(_title);
// making a new instance of array and copying all the values of _views
if(_views!=null){
this.views=new int[_views.length];
for(int i=0 ;i<_views.length ;i++){
this.views[i] = _views[i];
}
}
}
/**
*
* @return the number of days for which view history is kept
* return 0 if views is null
*/
public int getHistoryLength() {
return 0;
//to be completed
}
/**
*
* @return total number of views (return 0 if views is null)
*/
public int getTotalViews() {
return 0;
}
/**
*
* @return the index of the day that had the least views.
* return null if views is null or empty
*/
public Integer indexOfLeastViews() {
return 0; //to be completed
}
/**
*
* @return the maximum number of daily views.
* return 0 if views is null or empty.
*/
public int highestViewCount() {
return 0; //to be completed
}Editor is loading...