Assignemnt #31 CompoundBooleanExpressions
Code
///Name: Morgan Kaplan
///Period: 5
///Project Name: CompoundBooleanExpressions
///File Name: CompoundBooleanExpressions.java
import java.util.Scanner;
public class CompoundBooleanExpressions
{
public static void main( String[] args )
{
Scanner momo= new Scanner(System.in);
int age;
double income, attractiveness;
boolean allowed;
System.out.println( "Enter your age: " );
age=momo.nextInt();
System.out.println( "Enter your yearly income: ");
income=momo.nextDouble();
System.out.println( "How attractive are you, on a scale from 0.0 to 10.0? " );
attractiveness=momo.nextDouble();
allowed= (age > 25 && age< 40 && ( income > 50000 || attractiveness >= 8.5) );
System.out.println( "You are allowed to date my grandchild: " + allowed + " " );
}
}
Picture of Output