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
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
Get step-by-step solutions from verified subject matter experts
