-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAge.java
More file actions
34 lines (25 loc) · 823 Bytes
/
Copy pathAge.java
File metadata and controls
34 lines (25 loc) · 823 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
/**
* Tisha Greenidge
* CSCIE-10b
* HW 4
*
*/
import javax.swing.*;
import java.awt.*;
public class Age {
public static void main (String [] Args) {
String age = null;
age = JOptionPane.showInputDialog (null, "What's your age, cowboy?");
while( Integer.parseInt (age) < 0){
JOptionPane.showMessageDialog (null, "Please enter a number 0 or more");
age = JOptionPane.showInputDialog (null, "What's your age, cowboy?");
}
if( Integer.parseInt (age) < 40){
JOptionPane.showMessageDialog
(null, "My, are young! You have only just begun to live child!");
} else {
JOptionPane.showMessageDialog
(null, "Dang, you are old! You are over the hill and far away!");
}
}
}