class Song2After extends Object120 { String title; String artist; double length; // running time, in s. boolean isCopyrighted; // the "constructor": Song2After( String t, String a, double l, boolean isC ) { // Song2 this = /* a Song2 object w/ all fields "zero-ish" */; // implicit -- don't write it! this.title = t; this.artist = a; this.length = l; this.isCopyrighted = isC; // return this; // implicit -- don't write it! } /** return whether `s` can be stored using `space` disk-space. * @param s the song to consider * @param space the amount of available space it has to fit into, in B. */ static boolean willFit( Song2After s, int space ) { return (s.length/60)*3.0*Math.pow(2,20) <= space; } /** return whether one song is shorter than another. * @return whether s1 is shorter than s2. */ static boolean isShorter( Song2After s1, Song2After s2 ) { return (s1.length < s2.length); } /** return a remix of a song. * @return `orig` remixed by D.J. `dj`, who added `newMaterialLength` seconds of ill beatz. */ static Song2After remix( Song2After orig, String dj, double newMaterialLength ) { return new Song2After( orig.title + " (" + dj + " remix)", orig.artist + " vs " + dj, orig.length + newMaterialLength, false ); } static void testAll() { // some examples of Song2 objects: Song2After s1 = new Song2After("Old Town Road", "Lil Nas X", 120, true); Song2After s2 = new Song2After("Ring Ring", "Abba", 180, true); Song2After s2a = new Song2After("Ring Ring", "Abba", 180, true); printTestMsg("remix"); assertEquals( new Song2After( "Old Town Road (ibarland remix)", "Lil Nas X vs ibarland", 150, false ), remix(s1, "ibarland", 30 ) ); assertEquals( new Song2After("Ring Ring (saltman remix)", "Abba vs saltman", 180, false), remix(s2, "saltman", 0 ) ); printTestSummary(); } public static void main( String[] args ) { testAll(); } }