Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a program in java that reads media objects such as books.java, music.java

ID: 3739775 • Letter: C

Question

Create a program in java that reads media objects such as books.java, music.java, and video.java( I have already created those files). Implement my own HashMap implementation. I may not use java.util.HashMap or java.util.TreMap. After it reads the media objects, it stores the media objects into my HashMap implementation using the unique ID as a key to the map(not an arraylist). It then prints the media objects from the HashMap in a friendly fashion. I may use iterator or for-each loop and do not just system.out.prinln the hashmap but iterate through it.

I need to create a program that reads in the Media objects(books,music,video) that I have attached. It will read it from a text file that those 3 files created which is also attached. I need to correctly create an appropriate HashMap that handles media objects such as below(books,music,video) without the use of java.util.HashMap or java.util.TreeMap . After HashMap reads the media objects, I want it to store the media objects into the hashmap that was just created and using the unique ID as the key to the map. Then print out the media objects from the HashMap.

Attached are the files I have created.

Media File

Music File

Video File

Text file it reads from

Explanation / Answer

Hi,

Below is the MyHashMap class, which is implementation of HashMap using an array. I have used Array of Media objects to store Video, Book and Music objects. Also I have used the idNumber as a key to insert the media into array. I have also created Tester Program, which reads the input from file and stores the video,book and music objects into hashmap and finally prints the contents of hashmap. Run the program and verify the output. Let me know if you have any questions.

MyHashMap.java

HashMapTester.java

Output:

Media [idNumber=2, itemName=Star Wars, type=video] Video [definition=high definition, format=DVD, director=George Lucas, rating=PG, genre=science fiction]
Media [idNumber=3, itemName=Star Wars Soundtrack, type=music] Music [format=CD, artist=John Williams]
Media [idNumber=4, itemName=Empire Strikes Back, type=video] Video [definition=high definition, format=DVD, director=George Lucas, rating=PG, genre=science fiction]
Media [idNumber=5, itemName=Object-Oriented Requirements Analysis, type=book] Book [format=print, author=Dr. Java Expert]
Media [idNumber=6, itemName=Empire Soundtrack, type=music] Music [format=digital, artist=John Williams]
Media [idNumber=7, itemName=mybook, type=book] Book [format=ebook, author=me]

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote