Hello, I'm trying to make a custom checkboard with given user input, in the form of (# of rows, # of columns, size of each square, filler character).
So the input 2 3 5 * would look like
*****.........*****
*****.........*****
*****.........*****
*****.........*****
*****.........*****
.........*****
.........*****
.........*****
.........*****
.........*****
I've made my loop, but I am unable to get more then a 1 1 1 checkerboard properly.
I am stuck on how to divide the filler characters to make the proper square size. As of now they are all one lined.
import java.util.*; public class Checker{ public static void main(String[] args) { int col, row, size; char filler; System.out.println("Please enter 3 numbers and a character."); //output Scanner scan = new Scanner(System.in); //input row = scan.nextInt(); col = scan.nextInt(); size = scan.nextInt(); filler = scan.next().charAt(0); // defined variables int r,c,i=0,j=0,k=0; for (r=1; r<=row; r++) {for (c=1; c<=col; c++) {do { if ((r % 2 != 0 && c % 2 !=0) || (r %2 == 0 && c % 2 == 0)) { do { System.out.print(filler); i++;} while (i<size); i = 0; } else { do { System.out.print(" "); j++;} while (j<size); j = 0; } k++; }while (k<size); k = 0; }System.out.println("\n");} System.out.println("\nHave a nice day. Goodbye."); } }