Question: 3) Write a static method and a test program for a method called digitRange() that takes an integer n as an argument and returns the

3) Write a static method and a test program for a method called digitRange() that takes an integer n as an argument and returns the largest difference between the individual digits in the number. For example the call digitRange(68437) should return 5 because the largest difference between individual digits is (8 - 3). You should test whether the number passed to the method is >= 0 and throw an IllegalArgumentException if not. Passing a 1 digit number should return a 0 (zero). You must test these cases: Method Call Value Returned digitRange(0) 0 digitRange(26) 4 digitRange(42) 2 digitRange(888) 0 digitRange(1234) 3 digitRange(24680) 8 digitRange(857492) 7 You can use any techniques you want, including Strings to inspect the individual digits. (25 pts) To get full credit, you must show the 7 test values defined above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!