0
我有一个任务来编写介绍“星级”程序的方法。我已经找到了所有for循环来打印设计,但是用它们编写类是我被绊倒的地方。我对编程还很陌生,我确信我的代码中有很多愚蠢的错误。创建一个类,并为STARS程序编写方法
Here's the Document of the Stars output
public class STARS {
Scanner scan = new Scanner(System.in);
public int rows;
public String part1, part2, part3, part4, part5;
public STARS(int rows){
}
private static String part1(int rows){
for (int i = 0; i < rows; i++) {
for (int stars = 0; stars < rows; stars++) {
System.out.print("*");
}
System.out.println("");
}
return " ";
}
private static String part2(int rows){
System.out.println("");
for (int i = 1; i <= rows; i++) {
for (int star = 1; star <= i; star++) {
System.out.print("*");
}
System.out.println("");
}
return " ";
}
您的实际问题并不明显,请您说清楚一点? – tddmonkey