Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

__________________________________________________________________________ ValleyPeakPlateau.java : /* * This program identifies the valleys, peaks, and plateaus * that are found in an array of ints. * * @creator

image text in transcribed__________________________________________________________________________

ValleyPeakPlateau.java :

/* * This program identifies the valleys, peaks, and plateaus * that are found in an array of ints. * * @creator gdt * @created 02017.01.28 */ public class ValleyPeakPlateau { public static void main(String[] argv) { int[][] arrays = { { 0, 5, 7, 7, 7, 4, 8, 7, 7, 7, 10, 2, 6 }, { 2, 8, 8, 8, 7, 9, 9, 9, 9, 9, 3, }, { 1, 9, 3, 5, 2, 7, 3, 5, 1, }, { 2, 5, 3, 2, 1, 9, 7, 8, }, { 4, 4, 7, 4, 4, 4, 2, }, { 2, 5, 3, 3, 7, 2, }, { 1, 2, 5, 9, 10, }, { 4, 3, 2, 1, 0, }, { 7, 7, 7, 7, }, { 6, 5, 5, 5 }, { 3, 3, 3, 9 }, { 1, 3, 2, }, { 1, 3, 2, }, { 1, 2, }, { 7, 5, }, { 6, 6, }, { 1, }, { }, }; for (int i = 0; i  

__________________________________________________________________________

The program MUST match the following output:

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) 
Specification Copy the program ValleyPeakPlateau.java to your computer and implement the method named valleyPeakPlateau() The static void valleyPeakPlateau(intl] a) method prints to the standard output stream the valleys, peaks, and plateaus found in the int array that it receives as a parameter. Only arrays having two or more elements are processed The following are definitions for val ley, peak, and plateau the following three valley/peak definitions use the variables: int a an array of ints of named a int n the length of array a, where n 2 2 int i index into array a when i is 0 ali is valley if a[i] less than ali+1] a[i] is peak if a[i] greater than a[i+1] when 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Upgrade Migration And Transformation Tips And Techniques

Authors: Edward Whalen ,Jim Czuprynski

1st Edition

0071846050, 978-0071846059

More Books

Students also viewed these Databases questions