I need this script to throw a catch block so that if the answer entered does not
ID: 3713286 • Letter: I
Question
I need this script to throw a catch block so that if the answer entered does not fall between the numeric number of 0-7 it continually asks for a number between 0-7. It has to be a number not a letter
public static int getType() {
int eType;
Scanner input = new Scanner(System.in);
System.out.println("Equipment types:");
for (int x = 0; x < Equipment.EQUIP_TYPES.length; ++x)
System.out.println(" " + x + " " + Equipment.EQUIP_TYPES[x]);
System.out.print("Enter equipment type >> ");
eType = input.nextInt();
return eType;
Explanation / Answer
//Please try to use this code
//If you still need some help regarding this solution please leave a comment thanks..............
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.