Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q4 Streaming Service Videos (Total 5 marks) A streaming service can display videos to users ordered in multiple ways. You are required to provide code
Q4 Streaming Service Videos (Total 5 marks) A streaming service can display videos to users ordered in multiple ways. You are required to provide code that will allow an ArrayList of Video objects to be sorted in two different ways: a) Sort 1: Each video has a popularity score between 0 and 100 , inclusive. The higher the popularity score, the more popular the video. The videos should be sorted from most popular to least popular. b) Sort 2: Each video has a category and title. Order the video into their appropriate categories (categories will be displayed in alphabetical order) and then alphabetically by title in each category. The Video class is provided below for you to use. class video 1 private string title; private String category; private int popularity; public Video (String title, String category, int popularity) 1 this.title = title; this. category = category; this.popularity = popularity; f public Video (String title, String category) i this (title, category, 0); 1 public String getitle() i return title; f public string getCategory () 1 return category; f public int getPopularity() 1 return popularity; b Coverride public string tostring() 1 return title +" (" + category + ") ("+ popularity + " ) "; \}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started