Question: One Direction * * Ask the user to enter integers. As long as the numbers are * all increasing (or equal) or decreasing (or equal),

One Direction
   *
   * Ask the user to enter integers. As long as the numbers are
   * all increasing (or equal) or decreasing (or equal), let them
   * keep entering numbers. As soon as a number is entered that
   * changes direction, however, stop and print the number
   * of inputs, then "Wrong Direction".
   *
   * Example:
   * Enter numbers with returns between
   * 2
   * 3
   * 4
   * 4
   * 5
   * 2
   * 6 inputs
   * Wrong direction
   */
   public void oneDirection(){
       // Leave these two lines
       Scanner scan = new Scanner(System.in);
       System.out.println("Enter numbers with returns between");
     
     
     
       // Add the number to this line
       System.out.println(" inputs");
       // And leave this line.
       System.out.println("Wrong direction");

Step by Step Solution

3.44 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This question is incomplete because it is missing the implementation details for handling the user input and checking whether the input sequence is in... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!