Question: Write code 13 15 16 18 19 20 21 23 24 14 public class HeartRate { // Instance variables -17 private double value; W Constructor

13 15 16 18 19 20 21 23 24 14 public class HeartRate { // Instance variables -17 private double value; W Constructor public HeartRate (double value) { this.value = value; 22 ) // Methods; you should remove the block comments and complete the method bodies public double getValue() { // TODO Add your own code here to get the value of this object (the heart rate) 1 public void setValue(double newalue) { 11 Todo Add your own code here to set the the value for the object (the heart rate) 1 public String toString() { // TODO Add your own code here to display the contents of this HeartRate object 25 26 E27 28 29 30 131 32 33 34 835 36 37 9 public class TestHeartRate { 10 11 @Test 12 public void testsetValue() { 13 HeartRate h = new HeartRate(17.4); 114 h.setValue(486.2); 115 assertEquals(486.2, h.getValue(), 0.001); 16 } 17 18 @Test 19 public void testToString() { 20 HeartRate h = new HeartRate(15); 21 assertTrue(h.toString().contains (String.valueof(15))); 22 } 23 24 } 25
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
