Hey, so I'll post what I have, the code is pretty self explanatory. I have a hunch that there are more efficient ways to code than using these long and repetitive if statements, so if you guys could help me in that direction that would be great.
I also am getting compile errors with my >= signs, saying there is no symbol for boolean. I was wondering if you guys could help me with what a boolean is and how it is used in Java as well.
thank you.
import javax.swing.JOptionPane;
public class HomeworkThree
{
public static void main(String[] args)
{
JOptionPane.showMessageDialog(null, "Hello, my name is David");
String junk = JOptionPane.showInputDialog(null, "What is your age?");
int age = Integer.parseInt(junk);
if (age >= 65)
{
JOptionPane.showMessageDialog(null, "Time to retire");
}
else if (65 < age >=21)
{
JOptionPane.showMessageDialog(null, "You're an adult");
}
else if (age == 20)
{
JOptionPane.showMessageDialog(null, "Not a teenager but not quite an adult");
}
else if (13 > age <= 20)
{
JOptionPane.showMessageDialog(null, "You are a teenager");
}
else if (0 > age < 13)
{
JOptionPane.showMessageDialog(null, "You are a mere child");
}
else if (age >= 0)
{
JOptionPane.showMessageDialog(null, "You do not excist");
}
}//end class
}//end main