Assignment #31: Compound Booleans
Code
/// Name: Kiran O'Farrell
/// Period: 7
/// Program name: CompundBooleans
/// File Name: CompoundBooleans.java
/// Date Finished: 9/24/15
import java.util.Scanner;
public class CompoundBooleans {
public static void main (String[] args) {
Scanner keyboard = new Scanner(System.in);
int age, income;
double attractiveness;
Boolean allowed;
System.out.print("How old are you?");
age = keyboard.nextInt();
System.out.print("How much money do you make per year?");
income = keyboard.nextInt();
System.out.print("How attractive are you, on a scale of 1-10?");
attractiveness = keyboard.nextDouble();
allowed = ((age >= 25 && age <= 40) && (income >= 50000 || attractiveness >= 8.5));
System.out.println("You meet the requirements: \t" + allowed);
}
}
Picture of the output