Your Test Fixtures import orgjunitTest import static orgjuni

Your Test Fixtures import org.junit.Test; import static org.junit.Assert.*; import java.util.Arrays;//Feel free to add your own test cases public class ShowsTests {@Test public void testReturnsOldestLeastAired() {Show a = new Show(\"a\"); Show b = new Show(\"b\"); Show c = new Show(\"c\"); Show a_rerun = new Show(\"a\"); assertEquals(b, Shows.findOldestLeastAired(new Show[] {a, b, c, a_rerun}));} @Test public void testRerunSameNumberTimes() {Show a = new Show(\"a\"); Show b = new Show(\"b\"); Show b_rerun - new Show(\"b\"); Show a_rerun = new Show(\"a\"); assertEquals(new Show(\"b\"), Shows.findOldestLeastAired(new Show[] {a, b, b_rerun, a_rerun}));} @Test public void testNoShows() {assertEquals(null, Shows.findOldestLeastAired(new Show[] {}));}} Your solution import java.util.*; class Show {public String title; public Show(String title) {this.title = title;} public int hashCode() {return title.hashCode();} public Boolean equals(Object other) {(other instanceof Show) && this.title == ((Show) other).title;}} class Shows {public static Show findOldestLeastAired(Show[] shows) {//code goes here}} Unfortunately due to the tiny budget, the station hasn\'t been able to buy new content in ages and your previous function has been run a ridiculous number of times. So many that they\'ve now re-aired every show in the catalog. Write a function that takes the same previous list of shows and returns the show that has been aired the fewest times. If multiple shows have been aired the same minimal number of times, we want the show where the MOST RECENT AIRING WAS THE LONGEST TIME AGO.

Solution

also include java.text.SimpleDateFormat;

//java function to find oldest timestamp among all timestamps (oldes least aired , second part of the question )

sample input : we will read the shows like a,a,,a,b,b,c and print the least ocured character which is c and we will read timestamps for all the three shows and print the oldest timestamp . here it is \"01:45:12\" the oldest time.

 Your Test Fixtures import org.junit.Test; import static org.junit.Assert.*; import java.util.Arrays;//Feel free to add your own test cases public class ShowsTe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site