-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeightComparer.java
More file actions
33 lines (27 loc) · 876 Bytes
/
HeightComparer.java
File metadata and controls
33 lines (27 loc) · 876 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
import java.util.Scanner;
public class HeightComparer {
void output(double p1, double p2) {
if(p1 > p2) {
System.out.println("Person One is Taller than Person Two");
} else if(p1 < p2) {
System.out.println("Person Two is Taller than Person One");
} else {
System.out.println("Two Persons are of same height");
}
}
void getInput() {
System.out.println("-----------------------------");
System.out.println("HEIGHT COMPARE PROGRAM");
System.out.println("-----------------------------");
Scanner sc = new Scanner(System.in);
System.out.print("Person One: ");
double p1 = Double.parseDouble(sc.nextLine());
System.out.print("Person Two: ");
double p2 = Double.parseDouble(sc.nextLine());
sc.close();
output(p1, p2);
}
public static void main(String[] args) {
new HeightComparer().getInput();
}
}