Assignment: #ValleyPeakPlateau Due: 09/09/02018 Points: 4

### Specification

Copy the program ValleyPeakPlateau.java to your computer and implement the method named valleyPeakPlateau().

The static void valleyPeakPlateau(int[] a) method prints to the standard output stream the valleys, peaks, and plateaus found in the int[] parameter. Only arrays having two or more elements are processed.

The following are definitions for valley, peak, and plateau.

```   note:
int[] a ... an array of ints of named a
int n ... the length of array a, where n ≥ 2
int i ... index into array a

when i is 0
a[i] is valley if a[i] less than a[i+1]
a[i] is peak if a[i] greater than a[i+1]

when 0 < i < n - 1
a[i] is valley if a[i] is less than both a[i-1] and a[i+1]
a[i] is peak if a[i] is greater than both a[i-1] and a[i+1]
a[i] is plateau if a[i] equals both a[i-1] and a[i+1]

when i is n - 1
a[i] is valley if a[i] less than a[i-1]
a[i] is peak if a[i] greater than a[i-1]
```
##### The Program's Output

The output of the program must match the following. {output file}

```array: { 0, 5, 7, 7, 7, 4, 8, 7, 7, 7, 10, 2, 6, }
[0]=0 is a valley
[3]=7 is a plateau
[5]=4 is a valley
[6]=8 is a peak
[8]=7 is a plateau
[10]=10 is a peak
[11]=2 is a valley
[12]=6 is a peak

array: { 2, 8, 8, 8, 7, 9, 9, 9, 9, 9, 3, }
[0]=2 is a valley
[2]=8 is a plateau
[4]=7 is a valley
[6]=9 is a plateau
[7]=9 is a plateau
[8]=9 is a plateau
[10]=3 is a valley

array: { 1, 9, 3, 5, 2, 7, 3, 5, 1, }
[0]=1 is a valley
[1]=9 is a peak
[2]=3 is a valley
[3]=5 is a peak
[4]=2 is a valley
[5]=7 is a peak
[6]=3 is a valley
[7]=5 is a peak
[8]=1 is a valley

array: { 2, 5, 3, 2, 1, 9, 7, 8, }
[0]=2 is a valley
[1]=5 is a peak
[4]=1 is a valley
[5]=9 is a peak
[6]=7 is a valley
[7]=8 is a peak

array: { 4, 4, 7, 4, 4, 4, 2, }
[2]=7 is a peak
[4]=4 is a plateau
[6]=2 is a valley

array: { 2, 5, 3, 3, 7, 2, }
[0]=2 is a valley
[1]=5 is a peak
[4]=7 is a peak
[5]=2 is a valley

array: { 1, 2, 5, 9, 10, }
[0]=1 is a valley
[4]=10 is a peak

array: { 4, 3, 2, 1, 0, }
[0]=4 is a peak
[4]=0 is a valley

array: { 7, 7, 7, 7, }
[1]=7 is a plateau
[2]=7 is a plateau

array: { 6, 5, 5, 5, }
[0]=6 is a peak
[2]=5 is a plateau

array: { 3, 3, 3, 9, }
[1]=3 is a plateau
[3]=9 is a peak

array: { 1, 3, 2, }
[0]=1 is a valley
[1]=3 is a peak
[2]=2 is a valley

array: { 1, 3, 2, }
[0]=1 is a valley
[1]=3 is a peak
[2]=2 is a valley

array: { 1, 2, }
[0]=1 is a valley
[1]=2 is a peak

array: { 7, 5, }
[0]=7 is a peak
[1]=5 is a valley

array: { 6, 6, }

array: { 1, } (skipped)

array: { } (skipped)

```