//there is my code, all of it is correct accept i want the user to enter a random age and not have int set at 21. how can I make it so when i run the application the user enters their age and it will follow too the correct If statement.
import javax.swing.*;
public class Oldman
{
public static void main (String arg[] )
{
JOptionPane.showMessageDialog(null, "The Old Man says:");
//Read in a value
String enterNum = JOptionPane.showInputDialog(null, "What is your age?:");
//convert string to a number
double num1 = Double.parseDouble(enterNum);
int user = 21;
if (user <= 12) {
JOptionPane.showMessageDialog(null, "Howdy youngster!");
}
else if (user >12 && user <20){
JOptionPane.showMessageDialog(null, "Howdy, you're on your way!");
}
else if (user >=20 && user <40) {
JOptionPane.showMessageDialog(null, "Howdy, you're a mover and a shaker!");
}
else if (user >=40){
JOptionPane.showMessageDialog(null, "Howdy, old timer!");
}
}
}