|
I need to format my output. It looks like this. 1-9 | 10-19 | 20-29 | 30-39 | 40-49 | 50-59 | 60-69 | 70-79 | 80-89 | 90-100 |
I need all of the lines to match up so they are not all off center. This is my program.
package Justin_CSIS; import java.util.Scanner; public class Astract { public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in); int [] stars = new int[10]; int[] row = { 1, 9, 10, 19, 20, 29, 30, 39, 40, 49, 50, 59, 60, 69, 70, 79, 80, 89, 90, 100}; int input, x; do { System.out.println("Please enter number 1 through 100" + " with no decimals." + " Enter 0 to quit."); input = keyboard.nextInt(); x = input/10; }while(input !=0); for(int index = 0; index < 19; index++)
{ System.out.println(row[index] + "-" + row[index + 1] + " |"); } } }
|