In Java-- Please ensure all classes are complete and instructions are followed c
ID: 3604595 • Letter: I
Question
In Java--
Please ensure all classes are complete and instructions are followed completly.
Please ensure that all code is commented extensivly
Using the map ADT
Operations:
Create empty map
Find key in map
Find value of a given key, if key exists
Insert a key with its associated value, if key does not already exist
Remove a key and its associated value
Implement map ADT in file called mapChegg.java, to map email addresses (String, key) to people's names (string, value).
Your driver class should add at least 3 people, search for 2 people by key (email addresses) and remove all keys when done.
Here you define a class Map, decide how you are storing key, value pairs
Then have a Map() constructor, a method returning a boolean called findKey, a method returning the value of a given key getValue(key) if the key exists, ...
Then you will make a MapTester file.
Explanation / Answer
void mapAll(void (*fn)(KeyType, ValueType)) const;
void mapAll(void (*fn)(const KeyType&, const ValueType&)) const;
void mapAll(FunctorType fn) const;
Iterates through the map entries and calls fn(key, value) for each one. The keys are processed in an undetermined order.
Usage:
map.mapAll(fn);
void remove(KeyType key);
Removes any entry for key from this map.
Usage:
map.remove(key);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.