Program #31

Code

   
    /// Name: Afaf Nabeeha
    /// Period: 7
    /// Program Name: Compound Boolean Expressions
    /// File Name: Compound.java
    /// Date Finished: 10/9/2015 public class Compound

          import java.util.Scanner;
           
           public class Compound
           {
               public static void main( String[] args )
               {
                   Scanner keyboard = new Scanner(System.in);
           
                   int age;
                   double income, looks;
                   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? " );
                   looks = keyboard.nextDouble();
           
                   allowed = ( age > 25 && age < 40 && ( income > 50000 || looks >= 8.5 ) );
           
                   System.out.println( "You are allowed to date my grandchild: " + allowed );
               }
          }
            
            
    

Picture of the output

Assignment 31