Friday 6 February 2015

parrot is talking means true, if parrot is talking before hour 7 and after 20 then return true. hour limit is between 1 and 23.

import java.util.Scanner;
class Test
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("Enetr Boolean Value= ");
boolean talking=sc.nextBoolean();

System.out.print("Enter Hour value = ");
int hour=sc.nextInt();

if(talking && hour<7 || talking && hour>20)
{
System.out.println("true");
}
else
{
System.out.println("false");
}


}

}

No comments:

Post a Comment