// This interface represents linear distance
public interface Distance
{
public int getFeet();
public int getYards();
public int getMiles();
public Distance add(Distance other);
public String toString();
}
Exercise 1: Implement class AltDistance that implements interface Distance using one variable feet.
Exercise 2: Implement class AltDistance that implements interface Distance using three variables feet, yards, and miles.
Exercise 3: Which methods were easier to implement in the one-variable representation? Which methods were easier to implement in the three-variable representation?
Click Here For COMPLETE PROGRAM
No comments:
Post a Comment