Question: getvalue code to indicate the unit 14 public class Distance { 15 16 11 Enus of distance units 17 public enum Distanceunit { 18 KILOMETRES

14 public class Distance { 15 16 11 Enus of distance units 17 public enum Distanceunit { 18 KILOMETRES 19 MILES 20 3 22 25 26 29 Constants private static final double S_PER_MILE 1.609; private static final double MILES_PER_KM 2.621 1 Instance variables private double value; private Distanceunit distanceunit: 1/ Constructors public Distance(double value) { this.value = value; Default unit is this distanceunit DistanceUnit KILOMETRES; > public Distance(double value, Distanceunit distanceunit) { this distanceunat distanceunit; > 32 33 34 35 37 38 39 40 44 Methods: You should remove the comments and complete the method bodies for all the methods below Think that all these sethods are in the class for a reason, so you should use them all DO NOT MODIFY the signature of these methods T public double getValue() { 50 51 52 public double getValue (DistanceUnit unit) { // Add your own code here to indicate in which units you request the class to return the distance
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
