The code posted below is an occurrence problem with how many times a number from 1-100 occurs, program stops executing when user enters 0. As for my homework assignment, I need to have the input and output in separate methods besides the main method. The first thing I did was write the whole program, then I got the input/output to another method... now I am stuck. I can't seem to figure out how to get the input and output to be in their own methods. Please help and thanks!
package numberse; import java.util.Scanner; public class NumberSe { public static void main(String[] args) { System.out.println("FUN"); userInput(args); } public static void userInput(String[] args) { Scanner input = new Scanner(System.in); int[] count = new int[100]; int userIn = 0; for (userIn = 0; userIn < 100; userIn++) { count[userIn] = 0; } System.out.print("Enter the integers between 1 and 100: "); userIn = input.nextInt(); while (userIn != 0) { count[userIn]++; userIn = input.nextInt(); } for (userIn = 0; userIn < 100; userIn++) { if (count[userIn] != 0) { if (count[userIn] > 1) { System.out.println(userIn + " occurs " + count[userIn] + " times"); } else { System.out.println(userIn + " occurs " + count[userIn] + " time"); } } } } }