fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Main
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. }
  14. // *** Utility methods related to arrays ***
  15. /**
  16.   * @param n is an int > 1
  17.   * @return a randomly generated int >= 0 and < n
  18.   */
  19. public static int getRandomInt(int n)
  20. {
  21. int a = (int)(Math.random() * n);
  22. return a;
  23. }
  24.  
  25. /**
  26.   * Purpose: use Arrays.toString to display array in standard form
  27.   * @param nums the array to display
  28.   */
  29. public static void displayArray(int[ ] nums)
  30. {
  31. String s = Arrays.toString(nums);
  32. System.out.println(s);
  33. }
  34.  
  35. /**
  36.   * Purpose: build an array filled with randomly generated ints
  37.   * @param len is the length of the array
  38.   * @param max the maximum size of the elements in the generated array
  39.   * @return an array containing len elements, all >= 0 and < max; use
  40.   * getRandomInt(max) to fill the elements in this array
  41.   */
  42. public static int[ ] buildArray(int len, int max)
  43. {
  44. // TODO: write this method
  45. }
  46.  
  47. // *** Modify pattern method ***
  48. /**
  49.   * Purpose: modify array to ensure that no entries are too large
  50.   * @param nums the array to modify
  51.   * @param limit an int > 2
  52.   * Postcondition: nums is modified by replacing all entries > limit with the
  53.   * value limit
  54.   */
  55. public static void setLimit(int[ ] nums, int limit)
  56. {
  57. // TODO: write this method
  58. }
  59.  
  60. // *** Extract pattern method ***
  61. /**
  62.   * @param nums is the source array
  63.   * @param start the position of the first entry in nums to be extracted
  64.   * @return an array containing, in original order, all the entries from nums
  65.   * at positions >= start
  66.   * Pre-condition start >= 0 and < nums.length
  67.   * Post condition: nums is not changed
  68.   */
  69. public static int[ ] getEnd(int[ ] nums, int start)
  70. {
  71. // TODO: write this method
  72. }
  73. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:45: error: missing return statement
    }
    ^
Main.java:72: error: missing return statement
    }
    ^
2 errors
stdout
Standard output is empty