# if Statement
```java
Scanner scan = new Scanner(System.in);
System.out.println("How old are you?");
int age = scan.nextInt();
if (age < 18) {
System.out.println("You're too young to vote");
} else {
System.out.println("You're old enough to vote");
}
// Grade Boundaries
int mark = 45;
if (mark < 30) {
System.out.println("Fail");
} else if (mark < 40){
System.out.println("Pass");
} else if (mark < 50) {
System.out.println("Merit");
} else {
System.out.println("Distinction");
}
```
# Operators
* ==, <, >, <=, >=
* .equals() (for Strings)
* .equalsIgnoreCase()
* ! not
* | or
* & and
## Examples
```java
if (age>10 & age<19)
if(surname.equals("Ballantyne"))
if(surname.equalsIgnoreCase("Ballantyne"))
if(!answer.equals("quit"))
```
# Questions
Don't forget, you'll need to choose a suitable set of test data for each question.
1. Write a program that asks a user to input their BMI (body mass index) and then outputs their BMI Category as follows: Underweight = <18.5, Normal weight = 18.5–24.9, Overweight = 25–29.9, Obesity = BMI of 30 or greater
2. The grade boundaries for an exam are as follows: A 68, B 59, C 45, D 39, E 31, Fail 30 or less. Write a program that outputs a grade for a given mark.
3. Ask the user to input the name and age of two people. e.g. George, 32, Jill, 35. Get it to print out who is the youngest/oldest e.g. George is younger than Jill
4. Honorific Generator: Write a program that accepts as input a person's sex and age, and outputs the honorific Mr, Ms, Miss or Master
5. Days in the month: Input the name of the month and whether or not it's a leap year, then output the number of days in that month
## Extension
1. Write a quiz with 2 questions. Print out the users score out of 2 at the end of the quiz
2. Write a password checker. Give the user three chances to enter the correct password.
3. Personality test: Look at the personality test here <http://www.personalityquiz.net/profiles/typology/index.htm> Write a program that replicates this test.
4. Allow the user to input a number. Output if the number is odd or even
5. Search for the java switch case statement. Rewrite the last question using switch case.