So I am trying to create this with my program:
AAAAAAAA
AAAAAAA
AAAAAA
AAAAA
AAAA
AAA
AA
A
I am supposed to import the number of rows and the characters from a data file.
Here is the code I wrote for it:
import java.util.*;
import java.io.*;
public class Lab11d {
public static void main(String []args) throws IOException
{
Scanner input = new Scanner(new File("Lab11d.dat"));
while(input.next().equals("y"))
{
int row = input.nextInt();
char col = input.next().charAt(0);
String output = "";
for(int i = row; i>0; i--)
{
for(int j = i; i>0;j--)
{
if(j==row)
{
output+="";
continue;
}
else
output+=" ";
}
for(int k = row; k>0; k--)
output+=col;
}
System.out.println(output);
}
}
}
Here is the data file:
8 A
2 B
1 T
3 B
I don't have any errors that Eclipse found. When I run it, nothing is printed in the console. Does anyone have any suggestions?