When I run my code through the Junit test code I provided it does not work DistanceFitnessTracker.java public class DistanceFitnessTracker extends FitnessTracker { Distance distance; public DistanceFitnessTracker(String modelName, Distance distance) { super(modelName); this.distance = distance; }; } TestDistanceFitnessTracker public class TestDistanceFitnessTracker { @Test public void testTrackersDifferentSumNotEqual() { DistanceFitnessTracker a = new DistanceFitnessTracker("hr", new Distance(20)); DistanceFitnessTracker b = new DistanceFitnessTracker("hr", new Distance(20)); b.addDistance(new Distance(10)); assertNotEquals(a, b); assertNotEquals(b, a); } } DistanceFitnessTracker will represent a fitness tracker able to record only distance.I need the distance unit to be in Kilometers only Please modify it so it can pass the test and and fulfill the requirements needed
When I run my code through the Junit test code I provided it does not work
DistanceFitnessTracker.java
public class DistanceFitnessTracker extends FitnessTracker {
Distance distance;
public DistanceFitnessTracker(String modelName, Distance distance) {
super(modelName);
this.distance = distance;
};
}
TestDistanceFitnessTracker
public class TestDistanceFitnessTracker {
@Test
public void testTrackersDifferentSumNotEqual() {
DistanceFitnessTracker a = new DistanceFitnessTracker("hr", new Distance(20));
DistanceFitnessTracker b = new DistanceFitnessTracker("hr", new Distance(20));
b.addDistance(new Distance(10));
assertNotEquals(a, b);
assertNotEquals(b, a);
}
}
DistanceFitnessTracker will represent a fitness tracker able to record only distance.I need the distance unit to be in Kilometers only
Please modify it so it can pass the test and and fulfill the requirements needed
Trending now
This is a popular solution!
Step by step
Solved in 2 steps