So, this is basically what I have to do:
Ask the user to enter as many ints as they want, and tell them to type “done” when they are done entering the numbers.
Store these numbers in a data structure. (Think carefully about which one to use.)
Write a method that computes the sum of all the elements in the data structure.
Write a method that finds the smallest positive number in the data structure (return 9999 if there aren’t any positive numbers).
Call these methods on the data structure with the user’s numbers.
I have already written some of the code, but it's taking me no where.
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
if (in.hasNextInt())
System.out.println(in.nextInt());
else
in.next();
}
}
}