// Tyler Rigsby, CSE 142 // Simple program reads information about a user and indicates whether they can vote // (another test should be added for those born in US Territories) import java.util.*; public class VotingEligibility { public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.print("What is your age? "); int age = console.nextInt(); boolean isOver18 = age >= 18; System.out.print("Were you born in the USA (y/n)? "); String bornResponse = console.next(); boolean bornInUSA = bornResponse.startsWith("y"); System.out.print("Are you a naturalized citizen (y/n)? "); String naturalizedResponse = console.next(); boolean naturalized = naturalizedResponse.startsWith("y"); boolean meetsCitizenshipRequirements = bornInUSA || naturalized; if (isOver18 && meetsCitizenshipRequirements) { System.out.println("You can vote!"); } } }