Recall your very first challenge? If not, look for a little green tag. You came up with some algorithm to lay black and white tiles on a floor. Now that you know how to code, can you turn your pseudo code into Java code?
Feel free to use a letter or a number to represent a "black" tile or a "white" tile. For instance,
BBBBBBBBBBBBB
B B
B B
B BBB B
B B
B B
BBBBBBBBBBBBB
import java.util.*;
class Randomizer {
public static void main(String[] args) {
System.out.println("Please enter the amount of rows");
Scanner r=new Scanner(System.in);
int r1=r.nextInt();
System.out.println("Please enter the amount of columns");
//Scanner c=new Scanner(System.in);
int c1=r.nextInt();
for(int r0=1; r0<=r1; r0++ )
{
if(r0==1 || r0==r1)
{
for(int c0=1; c0<=c1; c0++ )
{
System.out.print("b");
}
System.out.println();
}
else if(r0==(r1/2)+1)
{
for(int c0=1; c0<=(c1-1); c0++ )
{
if(c0==1 || c0==(c1-1))
{
System.out.print("b");
}
if(c0==c1/2)
{
System.out.print("b");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
else
{
for(int c0=1; c0<=c1; c0++ )
{
if(c0==1 || c0==c1){
System.out.print("b");
}
if(1<c0 && c0<c1){
System.out.print(" ");
}
}
System.out.println();
}
}
}
}