Question: Can someone please fix my code and explain it please I have been struggling. It keeps outputting the middle term but I want it to
Can someone please fix my code and explain it please I have been struggling. It keeps outputting the middle term but I want it to only output "Too many numbers" when the following is used as input:
My code is as follows:
import java.util.Scanner;
public class LabProgram
public static void mainString args
Scanner scnr new ScannerSystemin;
int userValues new int; Set of data specified by the user
int count ;
boolean keepGoing true;
whilekeepGoing
int numbers scnrnextInt;
ifnumbers
keepGoing false;
else ifcount userValues.length
userValuescount numbers;
count;
else
System.out.printlnToo many numbers";
keepGoing false;
ifuserValuescount
int midVal count ;
System.out.printlnMiddle item: userValuesmidVal;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
