이렇게 출력을 생성하는 데 세 가지 방법을 어떻게 사용합니까?사각형을 그립니다. 누구든지 설명해 주시겠습니까
Please enter the fill character: "z"
Please enter the size of the box (0 to 80): "3"
+---+
|zzz|
|zzz|
|zzz|
+---+
내 코드는 상자를 생성 할 수 있지만 주위에 테두리를 만드는 다른 방법의 사용을 이해하는 데 문제가 있습니다.
import java.util.Scanner;
public class SolidBoxes
{
public static void main(String[] args)
{
int start = 0;
Scanner scan = new Scanner(System.in);
System.out.print("Please enter the fill character: ");
String character = scan.next();
System.out.print("Please enter the size of the box (0 to 80): ");
int size = scan.nextInt();
if (size > 80 || size < 0)
{
System.out.println("Please enter the size of the box (0 to 80): ");
size = scan.nextInt();
}
for (int i = 0; i < size; i++)
{
System.out.println();
for (int j = 0; j < size; j++)
{
System.out.print(character);
}
}
}
}
이 나에게 출력을 제공합니다
Please enter the fill character: z
Please enter the size of the box (0 to 80): 3
zzz
zzz
zzz
어떻게이 "+ --- + '와 다른 방법에 대한 두 가지 다른 방법을 추가 할 수 있습니다"| "를?
* 코딩 *으로 시작하십시오 ... –
감사합니다 러셀, 세 가지 방법을 사용하여 상자를 만들 수 있습니까? – Leroy
[무엇을 시도해 봤습니까?] (http://whathaveyoutried.com/) – ruakh