Question: Hello! I just need some help debugging my scanning method / my get choice method. Every time I run this program I keep getting the
Hello! I just need some help debugging my scanning method my get choice method. Every time I run this program I keep getting the same error of "Exception in thread "main" java.util.NoSuchElementException" Please let me know what I am doing wrong! All help is appreciated TIA!
public static void mainString args
final int MAXDEPS ;
double DEPOSIT MAXDEPS;
double userDep ;
int userChoice ;
System.out.printlnHello please make a selection!";
do
userChoice getChoiceuserChoice;
switch userChoice
case :
addNewDepDEPOSIT MAXDEPS, userDep;
break;
case :
depHistoryDEPOSIT userDep;
break;
case :
System.out.printlnYou are now exiting the program, have a great day!";
break;
default:
System.out.printlnInvalid selection. Please make a valid selection";
break;
whileuserChoice;
public static int getChoiceint userChoice
System.out.println;
System.out.println MAIN MENU ;
System.out.println Add New Deposit";
System.out.println View Deposit History";
System.out.println Exit";
System.out.println;
Scanner choice new ScannerSystemin;
userChoice choice.nextInt;
choice.close;
return userChoice;
public static void addNewDepdouble DEPOSIT, int MAXDEPS, double userDep
Scanner sc new ScannerSystemin;
for int i ; i MAXDEPS; i
System.out.printlnPlease enter in the amount to deposit or enter to stop: ;
userDep scnextDouble;
if userDep
break;
DEPOSITi userDep;
scclose;
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
