Assignemnt #31 Compound Boolean Expressions
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: Comparing Strings
///File Name: CBE.java
///Date: 10/9/2015
import java.util.Scanner;
public class CBE
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int age;
double income, attractiveness;
boolean allowed;
System.out.print( "Enter your age: " );
age = keyboard.nextInt();
System.out.print( "Enter your yearly income: " );
income = keyboard.nextDouble();
System.out.print( "How attractive are you, on a scale from 0.0 to 10.0? " );
attractiveness = keyboard.nextDouble();
allowed = ( age > 13 && age < 16 && ( income > 500 || attractiveness >= 8.5 ) );
System.out.println( "You are allowed to date me: " + allowed );
}
}
Picture of the output