Guyzz check whats the problem is
package com.codegym.task.task08.task0803;
import java.util.HashMap;
import java.util.Map;
/*
HashMap of cats
*/
public class Solution {
public static void main(String[] args) throws Exception {
String[] cats = new String[]{"Tiger", "Missy", "Smokey", "Marmalade", "Oscar", "Snowball", "Boss", "Smudge", "Max", "Simba"};
HashMap<String, Cat> map = addCatsToMap(cats);
for (Map.Entry<String, Cat> pair : map.entrySet()) {
System.out.println(pair.getKey() + " - " + pair.getValue());
}
}
public static HashMap<String, Cat> addCatsToMap(String[] cats) {
//write your code here
HashMap<String, Cat> map= new HashMap<String, Cat>();
map.put("hi",new Cat(cats[0]));
map.put("ti",new Cat(cats[1]));
map.put("hr",new Cat(cats[2]));
map.put("hp",new Cat(cats[3]));
map.put("hd",new Cat(cats[4]));
map.put("his",new Cat(cats[5]));
map.put("ht",new Cat(cats[6]));
map.put("tr",new Cat(cats[7]));
map.put("pr",new Cat(cats[8]));
map.put("cd",new Cat(cats[9]));
return map;
}
public static class Cat {
String name;
public Cat(String name) {
this.name = name;
}
@Override
public String toString() {
return name != null ? name.toUpperCase() : null;
}
}
}