Computer Science, asked by bhan61, 1 year ago



Question: Call Me, Maybe?

Pooja just got a new cellphone. She carries it everywhere, even to her morning college classes.

She normally answers calls, except in the morning. In the morning she answers only if her Mom calls. However she never answers any calls when she is sleeping.

Write a method Met to that takes in 3 boolean parameters:

the first boolean is true if it is morning and false if it is not morning

the second boolean is true if her mom is calling and false if her mom is not calling

the third boolean is true if she is sleeping and false if she is not sleeping

You have to print True if Pooja will answer the call and False if she will not answer it.

Only write the method - assume that the Class & main method have been defined.

Use the System.out.println() statement for printing.

Example Input: true false false
Output: False
Example Input: true true false
Output: True
Example Input: false true true
Output: False

Answers

Answered by nitish8089
2

complete code... import java.util.Scanner;   public class Program  {      public static void met(boolean morning, boolean mother, boolean sleeping){          if(sleeping){              System.out.println("false");          }          else {              if(morning){                  if(mother){                      System.out.println("true");                  }                  else{                      System.out.println("false");                  }              }          }      }      public static void main(String[] args) {          Scanner sc=new Scanner(System.in);          boolean morning=sc.nextBoolean();          boolean mother=sc.nextBoolean();          boolean sleeping=sc.nextBoolean();          Program.met(morning, mother, sleeping);}}


nitish8089: i get down code is not in look well...
nitish8089: but it's correct..
nitish8089: just join all parts
bhan61: okk
bhan61: no problem
bhan61: thanks for answering me
nitish8089: always welcome: :)
Similar questions