Assign isTeenager with true if kidAge is 13 to 19 inclusive. Otherwise, assign isTeenager with false. import java.util.Scanner; public class TeenagerDetector { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); boolean isTeenager; int kidAge; kidAge = scnr.nextInt(); if (isTeenAger { isMale = true; } else { isMale = false; } if (isTeenager) { System.out.println("Teen"); } else { System.out.println("Not teen"); } } }
Assign isTeenager with true if kidAge is 13 to 19 inclusive. Otherwise, assign isTeenager with false.
import java.util.Scanner;
public class TeenagerDetector {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
boolean isTeenager;
int kidAge;
kidAge = scnr.nextInt();
if (isTeenAger {
isMale = true;
}
else {
isMale = false;
}
if (isTeenager) {
System.out.println("Teen");
}
else {
System.out.println("Not teen");
}
}
}
import java.util.*;
public class TeenagerDetector {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
boolean isTeenager;
int kidAge;
kidAge = scnr.nextInt();
if(kidAge>=13 && kidAge<=19){
isTeenager = true;
}
else
isTeenager = false;
if (isTeenager) {
System.out.println("Teen");
}
else {
System.out.println("Not teen");
}
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images