Skip to content

Instantly share code, notes, and snippets.

@ganeshbabuNN
Last active April 8, 2024 14:03
Show Gist options
  • Save ganeshbabuNN/5c80d678dd89966a647e80527d922398 to your computer and use it in GitHub Desktop.
Save ganeshbabuNN/5c80d678dd89966a647e80527d922398 to your computer and use it in GitHub Desktop.
EPGPSD2024_Precendence Order of Logical Operators
/* Description Assume that you have made some modifications to make the lie detector more sensitive and accurate.
You will be taking chemicals X,Y, A and B as inputs. Also, you will take the heart rate(heartRate) as input.
The person is telling the truth if all the following conditions are met: Sum of amounts of X and Y is greater than 30 Either A is greater than 3 or B is less than 6 Heart rate is equal to 70
The first four lines of input will have X,Y,A and B as inputs in that particular order. The next line of input will have the heart rate. If the person is telling the truth, display "The statement said by the person is true".
If the person is lying then display "The statement said by the person is false".
*/
import java.util.*;
public class Source {
public static void main(String[] args) {
int x,y,z,a,b,heartRate;
Scanner input= new Scanner(System.in);
x=input.nextInt();
y=input.nextInt();
a=input.nextInt();
b=input.nextInt();
heartRate=input.nextInt();
z=x+y;
if(((z>30) && ((a>3) &&(b<6))) && (heartRate==70) ) {
System.out.println("The statement said by the person is true");
}else{
System.out.println("The statement said by the person is false");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment