Question: I need to fill in the //TO DO comments for the following java class: Coin.java public class Coin extends SimpleTreasure implements HasName { // TODO

I need to fill in the //TO DO comments for the following java class:

Coin.java

public class Coin extends SimpleTreasure implements HasName { // TODO instance variables with documentation comments /** * Constructs a new Coin with specified value and name. * * @param value * The value of the Coin. * @param name * The name of the Coin. Must not be null. */ public Coin(long value, String name) { super(value); // TODO } @Override public String getName() { return null; // TODO } @Override public String toString() { return null; // TODO } }

Other dependent classes:

SimpleTreasure.java

public class SimpleTreasure implements Treasure { // declaring instance variables private final long value; /** * Constructs a new SimpleTreasure with the specified value. * * @param value * The value to assign to the SimpleTreasure. */ public SimpleTreasure(long value) { this.value = value; } @Override public long getValue() { return value; } @Override public String toString() { return "Treasure value is:" + getValue(); } }

HasName.java

public interface HasName { /** * Returns the name associated with the object. * * @return the name associated with the object */ String getName(); }

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!