User Story
As a voting registration officer, I want to be able to determine a person's eligibility to vote based on their age, citizenship, and registration status, so that I can ensure that only eligible voters are registered to vote. When I receive a voter's information, I want to be able to input their age, citizenship status, and registration status into the system. The system should then check their eligibility by evaluating the inputted values and return a message indicating whether or not the voter is eligible to vote. If the voter is eligible, their registration should be approved. If they are not eligible, their registration should be rejected and they should be provided with information on how to become eligible. This will help to ensure that our voting system is fair and accurate.
Code
Integer age = 30;
Boolean isCitizen = true;
Boolean isRegistered = false;
String status;
if (age >= 18) {
if (isCitizen) {
if (isRegistered) {
status = 'You are eligible to vote.';
} else {
status = 'You are not registered to vote.';
}
} else {
status = 'You must be a citizen to vote.';
}
} else {
status = 'You must be at least 18 years old to vote.';
}
System.debug(status);