G
2013-04-02 17:22:18 UTC
I have to create many methods for an assignment, but I am having a problem with three of them. They are:
http://i.imgur.com/VBIhYxY.png
http://i.imgur.com/lqRnMxC.png
http://i.imgur.com/eCM8znG.png
This is the code I have so far:
public class MethodAssignment {
public static void main(String[] args) throws IOException
{
Scanner keyBoard = new Scanner( System.in );
System.out.print("Please enter the box character: ");
String boxScan = keyBoard.nextLine();
char boxChar = boxScan.charAt(0);
System.out.print("Please enter the size of the box: ");
int boxSize = keyBoard.nextInt();
int i;
for (i = 0; i < (boxSize+1)/2; i++) {
String thisLine = "|";
for (int j = 0; j < (boxSize+1)/2; j++) {
thisLine += boxChar;
}
thisLine += "|";
System.out.println(thisLine);
}
}
}
When run, this is what it asks and prints:
http://i.imgur.com/Z3ZQQxU.png
If anyone can help me with any and/or all of the methods that I need assistance with, that would be awesome. I cannot use arrays for this assignment. Thanks for your consideration.