-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathReview.java
More file actions
34 lines (28 loc) · 759 Bytes
/
Review.java
File metadata and controls
34 lines (28 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.util.Scanner;
public class Review {
static Scanner scnr = new Scanner(System.in);
public static void Greeting() {
System.out.println("Welcome.");
}
public static void userName() {
Greeting();
System.out.println("Please print your name.");
String name = scnr.next();
if ((name.charAt(name.length() - 1) == 'a') || ((name.charAt(name.length() - 1) == 'e')) ) {
System.out.println("Miss " + name);
}
else {
System.out.println("Mister " + name);
}
}
public static void numPeople(int s) {
for (int i = 1; i <= s; ++i) {
userName();
}
}
public static void main(String[] args) {
System.out.println("Please enter a number");
int s = scnr.nextInt();
numPeople(s);
}
}