Practice Problem 2 Split Diff
<< Practice ProblemWord Morph | OtherProjectsTrailIndex | Fold to the Sun >>
Write a method that will split the difference between two integers or doubles.
For example splitDiff(2,3)
returns 2.5
and splitDIff(2.0,3.0)
also returns 2.5
.
Add several more tests to the main method.
public class SplitDiffTester { public static void main(String[] args) { System.out.println(splitDiff(10,20)); System.out.println("expected 15.0"); System.out.println(splitDiff(9.5,20.5)); System.out.println("expected 15.0"); } }