Advertisement
Guest User

Frosts Java hw

a guest
May 3rd, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public boolean isLevelTrailSegment(int start, int end) {
  2. int min = this.markers[start];
  3. int max = this.markers[start];
  4. for (int i = start + 1; i <= end; i++) {
  5. if (min > this.markers[i]) {
  6. min = this.markers[i];
  7. }
  8. if (max < this.markers[i]) {
  9. max = this.markers[i];
  10. }
  11. }
  12. return ((max - min) <= 10);
  13. }
  14.  
  15. B)
  16. public boolean isDifficult() {
  17. int numChanges = 0;
  18. for (int i = 0; i < this.markers.length - 1; i++) {
  19. if (Math.abs(this.markers[i] - this.markers[i + 1]) >= 30) {
  20. numChanges++;
  21. }
  22. }
  23. return (numChanges >= 3);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement