Question: Can someone tell me what I am doing wrong? I keep getting erros i dont understand why. ``` package src; public class Coin extends Collectable

Can someone tell me what I am doing wrong? I keep getting erros i dont understand why. ``` package src; public class Coin extends Collectable { private int denomination; private int year; public Coin(int id, String desc, double price, int denom, int year) { super(id, desc, price); this.denomination = denom; this.year = year; } @Override public String toString( ) { return String.format("%d %d %d", super.toString( ), denomination, year); } } ``` CollectablesStore Class ``` package src; import java.util.*; public class CollectablesStore implements Iterator { private HashMap hm; public CollectablesStore() { hm = new HashMap(); } @Override public Iterator iterator() { return hm.values().iterator(); } public void store(Integer key, Collectable item) { hm.put(key, item); } public Collectable retrieve(Integer theKey) { return hm.get(theKey); } public String toString() { String returnValue = ''; for (Collectable c : hm.values()) { returnValue += c + " "; } return returnValue; }//End of ToString } ``` Collectable Class ``` package src; public class Collectable { private int id; private String description; private double price; public Collectable(int id, String desc, double price) { this.id = id; this.description = desc; this.price = price; } private int getId( ) { return id; } //@Override public String toString() { return String.format("%s %s %.2f", id, description, price); } } ``` Test Class ``` package src; public class Test { public static void main(String args) { Collectable c1 = new Collectable(1111, "Book", 5500.00); Collectable c2 = new Collectable(2222, "Baseball Card", 2700.00); Coin c3 = new Coin(3333, "Quarter", 10.50, 25, 1932); Coin c4 = new Coin(4444, "Silver Dollar", 38.00, 100, 1901); CollectablesStore s = new CollectablesStore ( ); s.store(c1.getId( ), c1); s.store(c2.getId( ), c2); s.store(c3.getId( ), c3); s.store(c4.getId( ), c4); for(Collectable c in s) { System.out.println(c); } System.out.println(s.retrieve(2222)); System.out.println(s.retrieve(4444)); } } ```

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!