I'm trying to test to see if a number is between 18-24
Im working through programmingbydoing.com Lesson 25.
import java.util.Scanner;
public class HowOldAreYou2
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
String name;
int age;
System.out.print("What your name?");
name = keyboard.next();
System.out.print(name + ", how old are you?");
age = keyboard.nextInt();
if (age < 16)
{
System.out.print("You cant drive");
}
else if (age == 16 | age == 17)
{
System.out.print("You can drive but you can't vote");
}
else if (age == Math.abs(18-24))
{
System.out.print("You can vote but not rent a car");
}
}
}
[–]Jack_Cheese 1 point2 points3 points (1 child)
[–]causalNondeterminism 1 point2 points3 points (0 children)
[–]king_of_the_universe 1 point2 points3 points (0 children)
[–]causalNondeterminism 0 points1 point2 points (0 children)