私は単純なミラープログラムを作成しましたが、これを変更するように求めました。ユーザー入力のあるJavaミラープログラム
まず、サイジングに静的な値を使用しました。今私はサイジングのユーザー入力を使用する必要があります。
これまでのところ、これは私が持っているものですが、どこでこれを行うべきかわかりません。 誰かがそれが偉大な助けになるならば。
私が入手したユーザー入力は、そのサイズに使用されるはずです。
また、printspaces()という名前のメソッドを作成する必要があります。このメソッドは、スペースを印刷してスペースを印刷するために使用するスペースの数を指定します。
という名前のメソッドを作成します。このメソッドは、印刷するドットの数を指定し、ドットを印刷するために使用します。
プリントドットとプリントスペースを追加するにはどのようなコードを削除する必要がありますか?
おかげ
package stackoverflow;
import java.util.Scanner;
public class Mirror_2 {
public static void main(String[] args) {
line(0);
top(0);
bottom(0);
line(0);
int SIZE;
Scanner Console = new Scanner(System.in);
System.out.print("Please enter Size: ");
int SIZE1 = Console.nextInt();
System.out.println("You entered integer " + SIZE1);
}
public static void line(int SIZE) {
// To change the lines at the bottom and top
System.out.print("#");
for (int i = 1; i <= SIZE * 4; i++) {
System.out.print("=");
}
System.out.println("#");
}
public static void top(int SIZE) {
// To change the top portion of the ASCII Art
for (int line = 1; line <= SIZE; line++) {
System.out.print("|");
for (int space = 1; space <= (line * -2 + SIZE * 2); space++) {
System.out.print(" ");
}
System.out.print("<>");
for (int dot = 1; dot <= (line * 4 - 4); dot++) {
System.out.print(".");
}
System.out.print("<>");
for (int space = 1; space <= line * -2 + SIZE * 2; space++) {
System.out.print(" ");
}
System.out.println("|");
}
}
public static void bottom(int SIZE) {
// To change the bottom portion of the ASCII Art
for (int line = SIZE; line >= 1; line--) {
System.out.print("|");
for (int space = 1; space <= line * -2 + SIZE * 2; space++) {
System.out.print(" ");
}
System.out.print("<>");
for (int dot = 1; dot <= line * 4 - 4; dot++) {
System.out.print(".");
}
System.out.print("<>");
for (int space = 1; space <= line * -2 + SIZE * 2; space++) {
System.out.print(" ");
}
System.out.println("|");
}
}
}