Guest User

Untitled

a guest
Jan 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. //(c) A+ Computer Science
  2. //www.apluscompsci.com
  3. //Name -
  4.  
  5. import java.lang.System;
  6. import java.lang.Math;
  7.  
  8. public class ArrayFunHouseTwo
  9. {
  10. //goingUp() will return true if all numbers
  11. //in numArray are in increasing order
  12. //[1,2,6,9,23] returns true
  13. //[9, 11, 13, 8] returns false
  14. public static int[] nums;
  15.  
  16. public static int smallerNumber;
  17. public static boolean truth;
  18. public static boolean goingUp(int[] numArray)
  19. {
  20. nums = numArray;
  21. int x = 0;
  22. while(x<nums.length-1)
  23. {
  24. if(nums[x]<nums[x+1])
  25. {
  26. truth = true;
  27. x++;
  28. }
  29. else
  30. {
  31. truth = false;
  32. break;
  33. }
  34. }
  35. return truth;
  36.  
  37. }
  38.  
  39. //goingDown() will return true if all numbers
  40. //in numArray are in decreasing order
  41. //[31,12,6,2,1] returns true
  42. //[31, 20, 10, 15, 9] returns false
  43. public static boolean goingDown(int[] numArray)
  44. {
  45. nums = numArray;
  46. int x = 0;
  47. while(x<nums.length-1)
  48. {
  49. if(nums[x]>nums[x+1])
  50. {
  51. truth = true;
  52. x++;
  53. }
  54. else
  55. {
  56. truth = false;
  57. break;
  58. }
  59. }
  60. return truth;
  61.  
  62. }
  63. //getValuesBiggerThanX will return an array that contains
  64. //count number of values that are larter than parameter x
  65. //[1,2,3,4,5,6,7,8,9,10,11,6],3,5 would return [6,7,8]
  66. public static int[] getCountValuesBiggerThanX(int[] numArray, int count, int x)
  67. {
  68. nums = numArray;
  69. return null;
  70. }
  71. }
Add Comment
Please, Sign In to add comment