I am having a hard time with this problem can you help me 5
I am having a hard time with this problem, can you help me ???
#5. fill in the copy contructor so that it sets its data to a copy of the data of the Coin that is passed in. Be sure that it creates a DEEP COPY. ( assuming that the Country class has a copy constructor that creates one).
 public class Coin {
   
 //data
 protected Country country;
 protected String coinName;
 protected int value;
   
   
 // constructor
 // default constructor
   
 public Coin()
 {
 this.country=new Country(\"US\");
 this.coinName=\"Quater\";
 this.value=25;
 
 }
   
 //parametirezed constructor
 public Coin(Country where,String theName,int theValue)
 {
   
   
   
   
   
   
   
   
   
 this.country=where;
 this.coinName=theName;
 this.value=theValue;
   
   
 }
   
 //copy constructor
 public Coin(Coin another)
 {
   
   
   
   
   
 }
   
   
 //methods
 //getValue()-returns its value
 public int getValue()
 {
 return value;
   
 }
   
 
 //toString-returns its String representation
 public String tostring()
   
 {
 return coinName+\"with value\"+value;
 }
   
 
 }
Solution
// Copy constructor modified
public Coin(Coin another)
 {
 this.country=new Country(another.country); // call to the copy Constructor of Country class
 this.coinName=another.coinName; // assigns instance member coinName of another object to coinName of //current object
 this.value=another.value; // assigns instance member value of another object to value of current object
 }


