Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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..............

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote