-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathManyprints.java
More file actions
23 lines (20 loc) · 743 Bytes
/
Manyprints.java
File metadata and controls
23 lines (20 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.Scanner;
public class ManyPrints {
// NOTE: do not change the method definition, e.g. add parameters to method
public static void printText() {
// Write your code here
System.out.println("In the beginning there were the swamp, the hoe and Java.");
}
public static void main(String[] args) {
// ask the user how many times the text should be printed
// use the while structure to call the printText method several times
Scanner reader = new Scanner(System.in);
System.out.println("How many? ");
int number = Integer.parseInt(reader.nextLine());
int i = 0;
while (i < number){
printText();
i++;
}
}
}