Hello,
For my Java class, I need to prompt the user for sales amounts, and break on a negative number. so far I have this
while (true) { for (int count = 0; count < salesAmounts.length; count++) { System.out.print("Please enter sales amount (negative to end): "); salesAmounts[count] = askSalesAmount.nextInt(); if (salesAmounts[count] <= 0) ; } for (int showArr: salesAmounts) { System.out.print(showArr);
this works, but it always prints a last "Please enter sales amount (negative to end):" statement. I can't figure out how to make it stop when the negative number is input.
also, I'm trying to show the numbers in the array. But the System.out.print doesn't show anything. Is there a good way to show the array with the numbers grouped together in a range. For example 0 through 10, 11 through 20 - and so on.