//14.6 // To describe a Gallery interface IGallery { int timeToDownload(int speed); boolean smallerThan(int bytes); boolean sameName(String filename); } //To describe an abstract class that extends Gallery abstract class AGallery implements IGallery { String name; int size; AGallery(String name, int size){ this.name = name; this.size = size; } //Determines the time ti will taek to download this file at the given speed int timeToDownload(int speed){ return this.size/speed; } //Determines if this file is smaller than the given maximum size boolean smallerThan(int bytes){ if(this.size < bytes) return true; else return false; } //Determines if the name of this file is the same as the given name boolean sameName(String filename){ if(this.name.equals(filename)) return true; else return false; } } // To describe am image file class Image extends AGallery { int height; int width; String quality; Image(String name, int size, int height, int width, String quality) { super(name, size); this.height = height; this.width = width; this.quality = quality; } } // To describe a text file class Text extends AGallery { int lines; Text(String name, int size, int lines) { super(name, size); this.lines = lines; } } // To describe a sound file class Sound extends AGallery { int seconds; Sound(String name, int size, int seconds) { super(name, size); this.seconds = seconds; } } class Examples{ Examples(){} Image img1 = new Image("Dog", 2345, 200, 300, "Hi"); Sound mp3a = new Sound("Low Rider", 4560, 150); Text txt1 = new Text("Words", 2424, 45); boolean t1 = (check this.img1.timeToDownload(5) expect 469); boolean t2 = (check this.img1.smallerThan(8756) expect true); boolean t3 = (check this.img1.sameName("Dog") expect true); boolean t4 = (check this.mp3a.timeToDownload(10) expect 456); boolean t5 = (check this.mp3a.smallerThan(2341) expect false); boolean t6 = (check this.mp3a.sameName("Low Rider") expect true); boolean t7 = (check this.txt1.timeToDownload(12) expect 202); boolean t8 = (check this.txt1.smallerThan(3535) expect true); boolean t9 = (check this.txt1.sameName("Not Right") expect false); }