Talking Parrot

 Talking Parrot


Problem Description


We have a loud talking parrot. The ""hour"" parameter is the current hour time in the range 0..23. We are in trouble if the parrot is talking and the hour is before 7 or after 20. Return true if we are in trouble.


parrotTrouble(true, 6) true

parrotTrouble(true, 7) false

parrotTrouble(false, 6) false

Logic Test Case 1


Input (stdin)

FALSE


19


Expected Output


false

Logic Test Case 2


Input (stdin)

TRUE


21


Expected Output


true


Code Area

import java.io.*;

import java.util.Scanner;

public class TestClass {

public static void main(String[] args) { 

       String ch;

       int a;

       Scanner s=new Scanner(System.in);

       ch=s.nextLine();

       a=s.nextInt();

       if((a<7)||(a>20))

       { 

         System.out.println("true");

       } 

       else

       {

         System.out.println("false");

       }

     }

}


Post a Comment

0 Comments