java - Issue with creating a shape with inputs for a row, column and a character to fill the shape -


I am accepting an integer value for rows and columns, then a string value for the character. If the user enters the character of 5 for the value of 5 for the row and 2 for the column for the user's line:

@@

@@

@@

@@

@@

The code so far is below, where the comment is, the place where I can input Loop is not working to make the loop work to create a shape with the input that is entered for the desired rows and columns using the loop.

  import java.util. *; Public class makeup {public static zero main (string [] args) {scanner = new scanner (System.in); String errors = "Please enter amount in category 1 and 25", result = ""; System.out.print ("Enter the number of rows:"); Int r = integrator.parcent (in nxtine ()); If (R & lt; 1 || R & gt; 25) system.out.printeline (error message); Else {System.out.print ("Enter the number of columns:"); Int c = integer.center (in.nextline ()); If (c & lt; 1 || c> 25) system.out.printeline (error message); Else {System.out.print ("Enter the symbol to use:"); String character = in.nextLine (); // is released from here}} System.out.println (results); }}  

You need two to loop i to calculate rows An internal loop for loop to print a line using an external and entered character. After printing all the columns of a row, you need to print a new line.

Something like this:

 for  (int i = 0; i & lt; r; i ++) {for (int j = 0; J & lt; c; j ++) {System.out.print ('@'); } System.out.println (); }  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -