Advertisement
JeffGrigg

Untitled

Nov 11th, 2020
1,694
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.51 KB | None | 0 0
  1. import junit.framework.TestCase;
  2.  
  3. public class ContinuousChange extends TestCase {
  4.     public static int f(final int value) {
  5.         if (value <= 10) {
  6.             return value * 7;
  7.         } else {
  8.             return value * 9 - 20;
  9.         }
  10.     }
  11.     public void test() {
  12.         assertEquals(0, f(0));
  13.         assertEquals(56, f(8));
  14.         assertEquals(63, f(9));
  15.         //
  16.         assertEquals(70, f(10));
  17.         //
  18.         assertEquals(79, f(11));
  19.         assertEquals(88, f(12));
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement