Inputs a DC Universe character and show its description if it is found. Uses HashMap concept of Java to create a String-String dictionary corresponding to name and description of characters.
This is a program in Java that creates a dictionary of the famous DC Universe characters. Ideally, it would contain all the characters and once a character's name is input, it will look for the name and then give its description.
Example: Lex Luthor: A fictional supervillain appearing in American comic books published by DC Comics.
It contains three methods:
1.) look(): Lets you look for a DC character, i.e., input its name and if found, provide you his/her description.
2.) add(): Lets you add a character's name and description to the existing dictionary.
3.) remove(): Lets you remove entries from the existing dictionary, in case, say wrong entries are given as input.
The program uses Hashmap concept of Java. Hashmap is basically a data structure that creates a key-value database. There are say n-number keys and corresponding to it are n different values. So once you have the key, you can print the value. Here, in this little piece of code, both the key and value are String.
Hope you will enjoy it :) !
Submitted by Kaustubh Srivastava (kaustubhSrv)
Download packets of source code on Coders Packet