Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A collection of Interfaces that define Behavior Interfaces have many uses - (1) to prescribe certain behaviors, (2) to commonly identify all classes that implement

image text in transcribed

image text in transcribed

image text in transcribed

A collection of Interfaces that define Behavior Interfaces have many uses - (1) to prescribe certain behaviors, (2) to commonly identify all classes that implement an interface, (3) to act as a functional interface that can be passed as a parameter. In the next lesson, we will explore use #3. But we will use interfaces for the first two purposes in this assignment. You will be building an application that combines different media collections from old style TV shows. Each TV show's collection will only be of one specific file type. You will build a class specific to each media collection. Each class will have an instance variable of type Sting called filename plus instance variables for the clip's metadata. Media Collection (Class) Metadata Type of Media DarkShadows Clip episode, speaker .wav SeinfeldClip speaker, year .wav RockyAndBullwinkleClip speakers .wav GameOfThrones Clip character .gif (animated) DarkClip scene .gif (animated) Here are the clips you will build an instance of: filename Media Collection Properties DarkClip Dark-Jonas.gif Dark-TheStranger.gif DarkShadows-Angelique.wav DarkClip Dark Shadows Clip scene = Jonas Walking Into Cave scene = Stranger Leaving Cave speaker = Angelique, episode=606 speaker = Doctor Hoffman, episode=613 speaker = Professor Stokes, episode=506 DarkShadows-Doctor Hoffman.wav DarkShadows Clip DarkShadows-Professor Stokes.wav DarkShadows Clip speaker = Zombie Sheriff Davenport, DarkShadows-Zombie.wav DarkShadows Clip Speaker - Zombie Jim Davenport, episode=942 GameOfThronesClip GameOfThrones Clip RockyAndBullwinkleClip character = Joffrey Baratheon character = Jon Snow speakers = [Natasha] GameOfThrones-Joffrey.gif GameOfThrones-Jon.gif RockyAndBullwinkle-Natasha.wav RockyAndBullwinkle- RockyAndBullwinkle.wav Seinfeld-Jerry.wav Seinfeld-Kramer.wav RockyAndBullwinkle Clip speakers = [Rocky, Bullwinkle] SeinfeldClip SeinfeldClip speaker = Jerry, year = 1997 speaker = Kramer, year = 1993 You will create all twelve instances of various clips and place them into an ArrayList. You will not use superclasses; rather you will use interfaces. The interfaces should define the play method according to the current types of media. At the moment, there are only collections of animated gifs and wav files, but you want to make sure that your ArrayList could cover other media forms, such as mp3 files or mp4 files in the future. Here is the code you will need to use to play wav files: System.out.println("Playing " + filename); Audio InputStream audioStream; try { Clip clip = AudioSystem.getClip(); clip.open(AudioSystem.getAudio InputStream(new File(filename)); clip.start(); Thread.sleep(clip.getMicrosecondLength() / 1000); clip.closeO; } catch (Exception e) { e.printStackTrace(); } And here is the code you will need to play animated gifs (using Java Swing) System.out.println("Playing " + filename); catch (Exception e) { e.printStackTrace(); } And here is the code you will need to play animated gifs (using Java Swing) System.out.println("Playing + filename); JFrame frame = new JFrame(); ImageIcon icon = new ImageIcon(filename); JLabel label = new JLabel(icon); frame.add(label); frame.packO; frame.setDefaultCloseOperation(WindowConstants. EXIT_ON_CLOSE); frame.setLocation(filename.length()* 10, filename.length() * 10); frame.setVisible(true); Your driver will build the various twelve media clips in the table above, add them to an ArrayList, then iterate through the ArrayList and play each one. In Eclipse, the media .wav and .gif files should be stored in an Eclipse folder at the same level as your src folder. You can find those files here. The Rubric of 2 Criteria Ratings Pts Completeness 2 pts Total Points: 2 A collection of Interfaces that define Behavior Interfaces have many uses - (1) to prescribe certain behaviors, (2) to commonly identify all classes that implement an interface, (3) to act as a functional interface that can be passed as a parameter. In the next lesson, we will explore use #3. But we will use interfaces for the first two purposes in this assignment. You will be building an application that combines different media collections from old style TV shows. Each TV show's collection will only be of one specific file type. You will build a class specific to each media collection. Each class will have an instance variable of type Sting called filename plus instance variables for the clip's metadata. Media Collection (Class) Metadata Type of Media DarkShadows Clip episode, speaker .wav SeinfeldClip speaker, year .wav RockyAndBullwinkleClip speakers .wav GameOfThrones Clip character .gif (animated) DarkClip scene .gif (animated) Here are the clips you will build an instance of: filename Media Collection Properties DarkClip Dark-Jonas.gif Dark-TheStranger.gif DarkShadows-Angelique.wav DarkClip Dark Shadows Clip scene = Jonas Walking Into Cave scene = Stranger Leaving Cave speaker = Angelique, episode=606 speaker = Doctor Hoffman, episode=613 speaker = Professor Stokes, episode=506 DarkShadows-Doctor Hoffman.wav DarkShadows Clip DarkShadows-Professor Stokes.wav DarkShadows Clip speaker = Zombie Sheriff Davenport, DarkShadows-Zombie.wav DarkShadows Clip Speaker - Zombie Jim Davenport, episode=942 GameOfThronesClip GameOfThrones Clip RockyAndBullwinkleClip character = Joffrey Baratheon character = Jon Snow speakers = [Natasha] GameOfThrones-Joffrey.gif GameOfThrones-Jon.gif RockyAndBullwinkle-Natasha.wav RockyAndBullwinkle- RockyAndBullwinkle.wav Seinfeld-Jerry.wav Seinfeld-Kramer.wav RockyAndBullwinkle Clip speakers = [Rocky, Bullwinkle] SeinfeldClip SeinfeldClip speaker = Jerry, year = 1997 speaker = Kramer, year = 1993 You will create all twelve instances of various clips and place them into an ArrayList. You will not use superclasses; rather you will use interfaces. The interfaces should define the play method according to the current types of media. At the moment, there are only collections of animated gifs and wav files, but you want to make sure that your ArrayList could cover other media forms, such as mp3 files or mp4 files in the future. Here is the code you will need to use to play wav files: System.out.println("Playing " + filename); Audio InputStream audioStream; try { Clip clip = AudioSystem.getClip(); clip.open(AudioSystem.getAudio InputStream(new File(filename)); clip.start(); Thread.sleep(clip.getMicrosecondLength() / 1000); clip.closeO; } catch (Exception e) { e.printStackTrace(); } And here is the code you will need to play animated gifs (using Java Swing) System.out.println("Playing " + filename); catch (Exception e) { e.printStackTrace(); } And here is the code you will need to play animated gifs (using Java Swing) System.out.println("Playing + filename); JFrame frame = new JFrame(); ImageIcon icon = new ImageIcon(filename); JLabel label = new JLabel(icon); frame.add(label); frame.packO; frame.setDefaultCloseOperation(WindowConstants. EXIT_ON_CLOSE); frame.setLocation(filename.length()* 10, filename.length() * 10); frame.setVisible(true); Your driver will build the various twelve media clips in the table above, add them to an ArrayList, then iterate through the ArrayList and play each one. In Eclipse, the media .wav and .gif files should be stored in an Eclipse folder at the same level as your src folder. You can find those files here. The Rubric of 2 Criteria Ratings Pts Completeness 2 pts Total Points: 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Database Technology Edbt 88 International Conference On Extending Database Technology Venice Italy March 14 18 1988 Proceedings Lncs 303

Authors: Joachim W. Schmidt ,Stefano Ceri ,Michele Missikoff

1988th Edition

3540190740, 978-3540190745

More Books

Students also viewed these Databases questions