Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void addNum(final ArrayList<Double> myAList, final Scanner kb)
- {
- //Prompt user for a number 0-100
- if(!(kb == null || myAList == null))
- {
- System.out.println("Please enter a number between (0 - 100): ");
- double number = kb.nextDouble();
- kb.nextLine();
- while(number < 0 || number > 100)
- {
- System.out.println("That was not a qualified number, try again");
- number = kb.nextDouble();
- kb.nextLine();
- }
- for(int x = 0; x < myAList.size() - 1; x++);
- {
- myAList.add(number);
- }
- }
- myAList.trimToSize();
- }
Add Comment
Please, Sign In to add comment