Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int pocketNumber(int q) {
- int repeat = 0;
- do {
- System.out.print("Please select the number of pockets you want to work with: ");
- Scanner qu = new Scanner(System.in);
- int userQu = qu.nextInt();
- if (userQu > 7 || userQu < 1) {
- System.out.println("Sorry, that is not a valid number of pockets. ");
- repeat = 1;
- } else {
- System.out.println("You have chosen " + userQu + " pockets to work with. ");
- return userQu;
- // break;
- } // once this complete, values erased.
- } while (repeat == 1);
- return q;
- }
- /* Output
- Hello World!
- Here is a list of the elements contained within your array:
- 0. 33
- 1. 34
- 2. 35
- 3. 36
- 2
- You have chosen 2. 35
- Please select the shirt sleeve length of your garment:
- None
- Cap sleeves
- Short sleeves
- 3/4 length sleeves
- Long sleeves
- Long sleeves with holes
- Long sleeves
- You have chosen Long sleeves
- Please select the number of pockets you want to work with: 5
- You have chosen 5 pockets to work with.
- Please enter the pocket you want to work with: 7
- Sorry, we cannot work with that pocket.
- What properties would you like to have for this pocket?
- i0
- Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
- at program$topClothing.managePockets(program.java:104)
- at program$topClothing.access$300(program.java:5)
- at program.main(program.java:207)
- Process finished with exit code 1
- */
Advertisement
Add Comment
Please, Sign In to add comment