Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are the purposes of promotion ?

Answered: 1 week ago

Question

1. Who will you assemble on the team?

Answered: 1 week ago

Question

Did the team members feel that their work mattered

Answered: 1 week ago