I am a java beginner, please keep that in mind. I have to make a program that reads a number, and then displays that amount of exclamation mark "!".
This is what i have:
import java.util.Scanner;
import java.io.PrintStream;
class E_HerhaalKarakter1 {
PrintStream out;
E_HerhaalKarakter1 () {
out = new PrintStream(System.out);
}
String printUitroeptekens (int aantal) {
String output = "!"
for (int i = 0; i <= aantal; i++) {
output.concat("!");
}
return output;
}
void start () {
Scanner in = new Scanner(System.in);
out.printf("Hoeveel uitroeptekens wilt u weergeven?
");
if(in.hasNext()) {
out.printf("baldbla");
printUitroeptekens(in.nextInt());
out.printf("%s",output);
}
}
public static void main (String[] argv) {
new E_HerhaalKarakter1().start();
}
}
Thank you
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…