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 transcribedimage 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 GameOfThronesClip character .gif (animated) DarkClip scene .gif (animated) Here are the clips you will build an instance of: filename Media Collection DarkClip Dark-Jonas.gif Dark-TheStranger.gif DarkShadows-Angelique.wav DarkClip DarkShadowsClip DarkShadows-Doctor Hoffman.wav DarkShadowsClip Properties scene = Jonas Walking Into Cave scene = Stranger Leaving Cave speaker = Angelique, episode=606 speaker = Doctor Hoffman, episode=613 speaker = Professor Stokes, episode=506 speaker = Zombie Sheriff Davenport, episode=942 character = Joffrey Baratheon character = Jon Snow speakers = [Natasha] DarkShadows-Professor Stokes.wav DarkShadowsClip DarkShadows-Zombie.wav DarkShadows Clip GameOfThronesClip GameOfThronesClip RockyAndBullwinkleClip GameOfThrones-Joffrey.gif GameOfThrones-Jon.gif RockyAndBullwinkle-Natasha.wav RockyAndBullwinkle- RockyAndBullwinkle.wav Seinfeld- Seinfeld-Kramer.wav RockyAndBullwinkleClip speakers = [Rocky, Bullwinkle) SeinfeldClip speaker = Jerry, year = 1997 speaker = Kramer, year = 1993 SeinfeldClip 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: + filename); System.out.println("Playing AudioInputStream audioStream; try { Clip clip = Audiosystem.getClip(); clip.open(AudioSystem.getAudioInputStream(new File(filename)); clip.start(); Thread.sleep(clip.getMicrosecondLength() / 1000); clip.close(); } 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); Frame frame = new JFrame(); ImageIcon icon = new ImageIcon(filename); JLabel label = new JLabel(icon); frame.add(label); frame.pack(); 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. 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 GameOfThronesClip character .gif (animated) DarkClip scene .gif (animated) Here are the clips you will build an instance of: filename Media Collection DarkClip Dark-Jonas.gif Dark-TheStranger.gif DarkShadows-Angelique.wav DarkClip DarkShadowsClip DarkShadows-Doctor Hoffman.wav DarkShadowsClip Properties scene = Jonas Walking Into Cave scene = Stranger Leaving Cave speaker = Angelique, episode=606 speaker = Doctor Hoffman, episode=613 speaker = Professor Stokes, episode=506 speaker = Zombie Sheriff Davenport, episode=942 character = Joffrey Baratheon character = Jon Snow speakers = [Natasha] DarkShadows-Professor Stokes.wav DarkShadowsClip DarkShadows-Zombie.wav DarkShadows Clip GameOfThronesClip GameOfThronesClip RockyAndBullwinkleClip GameOfThrones-Joffrey.gif GameOfThrones-Jon.gif RockyAndBullwinkle-Natasha.wav RockyAndBullwinkle- RockyAndBullwinkle.wav Seinfeld- Seinfeld-Kramer.wav RockyAndBullwinkleClip speakers = [Rocky, Bullwinkle) SeinfeldClip speaker = Jerry, year = 1997 speaker = Kramer, year = 1993 SeinfeldClip 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: + filename); System.out.println("Playing AudioInputStream audioStream; try { Clip clip = Audiosystem.getClip(); clip.open(AudioSystem.getAudioInputStream(new File(filename)); clip.start(); Thread.sleep(clip.getMicrosecondLength() / 1000); clip.close(); } 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); Frame frame = new JFrame(); ImageIcon icon = new ImageIcon(filename); JLabel label = new JLabel(icon); frame.add(label); frame.pack(); 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

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

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

Explain the advantage of establishing a tax calendar.

Answered: 1 week ago

Question

Use of assessments to determine trainees learning styles.

Answered: 1 week ago

Question

7. Discuss the advantages of embedded learning.

Answered: 1 week ago