java code Using bool. Write code to assign true to isTeenager if kidAge is 13 to
ID: 3737170 • Letter: J
Question
java code
Using bool.
Write code to assign true to isTeenager if kidAge is 13 to 19 inclusive.
import java.util.Scanner;
public class TeenagerDetector {
public static void main (String [] args) {
boolean isTeenager = false;
int kidAge = 0;
kidAge = 13;
/* Your solution goes here */
if (isTeenager) {
System.out.println("Teen");
}
else {
System.out.println("Not teen");
}
return;
}
}
Write code to assign true to isTeenager if kidAge is 13 to 19 inclusive.
import java.util.Scanner;
public class TeenagerDetector {
public static void main (String [] args) {
boolean isTeenager = false;
int kidAge = 0;
kidAge = 13;
/* Your solution goes here */
if (isTeenager) {
System.out.println("Teen");
}
else {
System.out.println("Not teen");
}
return;
}
}
Explanation / Answer
Explanation:
Below is the Java code for above problem with proper description provided within comments itself. Below code some sample output screenshots are attached.
If you need any other help for this Comment me below. Thanks
Java code :
Sample Output :
Enter the kid age : 12
Not teen
Enter the kid age : 13
Teen
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.