Question: This assignment will make use of a data structure which in Java is called Array List and in C# is called List. Going forward, both

This assignment will make use of a data structure which in Java is called “Array List” and in C# is called “List”. Going forward, both will be simply referred to as a “list”, for simplicity. This assignment requires that a UML diagram is submitted along with your code. UML diagram entities must contain: • The name of the class • All of the classes’ fields and access levels (types are optional) • All of the classes’ methods (constructors are optional) • Arrows indicating the relationship between classes (i.e.: parent and child)

Requirements The features described below must be in your program.

• A total of five classes: Driver, Media, Image, Music, and Video

• A total of 3 interfaces: IMediaStandard, IAudioStandard, and IImageStandard

• Interface IMediaStandard has a single method called “getMediaInfo()”. It takes no parameters and returns a string.

• Interface IAudioStandard is a sub-interface of IMediaStandard and has a single method called “getAudioCodec()”. It takes no parameters and returns a string.

• Interface IImageStandard is a sub-interface of IMediaStandard and has a single method called “getImageCodec()”. It takes no parameters and returns a string.

• Media must be abstract and have the following private fields: o A string field named fileName;

o An integer field named id;

o A static integer field named nextId;

• Media must have the following constructors:

o The default constructor sets id to nextId and increments nextId by one.

o The overloaded constructor takes a String which is used to set fileName. It then sets id to nextId and increments nextId by one.

• Media must have getters for fileName and id.

• Image is a subclass of Media, must implement IImageStandard, and must have the following private field:

o A string named imageCodec.

• Image must have an overloaded constructor which takes in a String name and a String imageCodec. It must call its parent constructor and pass it “name”, while setting its imageCodec field with the one in the parameters.

• It must implement getImageCodec(), which returns the following string:

Image codec: [IMAGE_CODEC_FIELD]

• It must implement getMediaInfo(), which returns the following string: Image ID: [ID] Image name: [NAME] Image codec: [IMAGE_CODEC_FIELD]

Music is a subclass of Media, must implement IAudioStandard, and must have the following private field: o A string named audioCodec

• Music must have an overloaded constructor which takes in a String name and a String audioCodec. It must call its parent constructor and pass it “name”, while set its audioCodec field with the one in the parameters.

• It must implement getAudioCodec(), which returns the following string: Audio codec: [AUDIO_CODEC]

• It must implement getMediaInfo(), which returns the following string: Music ID: [ID] Music name: [NAME] Audio Codec: [AUDIO_CODEC_FIELD]

• Video is a subclass of Media, must implement IImageStandard and IAudioStandard, and must have the following private fields: o A string named imageCodec. o A string named audioCodec.

• Video must have an overloaded constructor which takes in a String name, a String imageCodec, and a String audioCodec. It must call its parent constructor and pass it “name”, while setting its imageCodec and audioCodec fields with the ones in the parameters.

• It must implement getImageCodec(), which returns the following string: Image codec: [IMAGE_CODEC_FIELD]

• It must implement getAudioCodec(), which returns the following string: Audio codec: [AUDIO_CODEC_FIELD]

• It must implement getMediaInfo(), which returns the following string: Video ID: [ID] Video name: [NAME] Image Codec: [IMAGE_CODEC_FIELD] Audio Codec: [AUDIO_CODEC_FIELD]

• The Driver must create a List of Media called allMedia. It must then run a menu in a loop with the following options:

o Add image: Prompts for a name and an image codec. Creates an instance of an Image with the information prompted and adds it to allMedia. o Add music: Prompts for a name and an audio codec. Creates an instance of a Music with the information prompted and adds it to allMedia.

o Add video: Prompts for a name, an image codec, and an audio codec. Creates an instance of a Video with the information prompted and adds it to allMedia.

o Show images: Traverses allMedia, calling getMediaInfo() only on instances of Images.

o Show music: Traverses allMedia, calling getMediaInfo() only on instances of Music.

o Show videos: Traverses allMedia, calling getMediaInfo() only on instances of Videos.

o Show images and videos: Traverses allMedia, calling getMediaInfo() only on instances of objects which implement IImageStandard.

o Show music and videos: Traverses allMedia, calling getMediaInfo() only on instances of objects which implement IAudioStandard.

o Exit: Terminates the program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!