There is some problem with my if statements. Error shows this Problem Could you help me figure out what's wrong with it ? The main task is that a motor insurance company has 4 categories of insurance based on the age and gender of the applicant.
this is the code :
String gender, age;
char group;
int genderint, ageint;
gender = JOptionPane.showInputDialog("Please specify your gender(1 for male, 0 for female)");
age = JOptionPane.showInputDialog("Please enter your age");
genderint = Integer.parseInt(gender);
ageint = Integer.parseInt(age);
if (gender = 0 || 1 && age = > 18 && < 26) {
group = "Category A";
} else if (gender = 0 && age = > 27 && < 60) {
group = "Category B";
} else if (gender = 1 && age = > 27 && < 60) {
group = "Category C";
} else if (gender = 0 || 1 && age = > 60) {
group = "Category D";
} else if (gender = 0 || 1 && age = < 18) {
JOptionPane.showMessageDialog(null, "Sorry, you're too young");
}
JOptionPane.showMessageDialog(null, "You have been assignet to" + group);
}
}
Aucun commentaire:
Enregistrer un commentaire