CSE 308 – Offline 2 Solved

$ 24.99
Category:

Description

Problem 1:
You have to implement a hierarchical file system using the “Composite” design pattern. You should implement the code in Java.
In a hierarchical file system, there are different drives, folders and files. A drive can contain both folders and files. Under a folder, there can be folders and files. Any folder or directory can also be empty. There are common properties: name, type, directory. There is another property for any composite object: “component_count” which contains the number of leaf objects under the composite object.
There are two common functions named “list” to print the hierarchy under the composite object, and “details” to show the properties of the composite object.
For example, consider the following hierarchy:
Details of Music:

Name: Music
Type: Folder
Directory: “C:Music”
Component Count: 4

You do not know the user’s choice beforehand. So you have to take the inputs as required from the user. A user can create any folder and add the required folders and files under the folder. Similarly, a drive can be created and the required folders and files can be added under the drive. Any object can be removed by the user. To remove a composite object, it is required to remove all the leaf objects under it.
Think of the boundary cases and include those in your code.

Problem 2:
An audio player can play only mp3 files. Now, we want to upgrade the audio player to play mp4, flv and vlc files. After the upgradation, the audio player can play the mp3 files by default. Implement the audio player using the “Adapter” design pattern in Java.
A user can add multiple music files to a playlist of the audio player. Take the list from the user containing the file name, its size and duration as input. The playlist can be empty. For example, a file “alone.mp4” is of type “mp4” and is named as “alone”. You have to display the currently playing playlist with the name, type, size and duration of each file.
If the files of any playlist are currently playing, you cannot add another playlist but you can add another file to the playlist. If you have to add another playlist, then check whether there is any playlist is playing by taking an elapsed time as an input. Check the elapsed time with the total duration of the most recent playlist to add a new playlist. Display the newly added playlist, if it can be added.

• Enclose all the files inside a single folder named after your 7 digit student id. For example, 1605001 will enclose all the files in a folder named 1605001. Then, zip the folder (the name of the zipped file will also be the same as the folder, i.e., 1605001.zip).

Reviews

There are no reviews yet.

Be the first to review “CSE 308 – Offline 2 Solved”

Your email address will not be published. Required fields are marked *