Respuesta :
Answer:
import java.util.Scanner;
public class num1 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
//Prompt for the person's age
System.out.println("What is your age");
int age = in.nextInt();
//Prompt for the person's years of citizenship
System.out.println("What is your years of citizenship");
int yearsCitizenship = in.nextInt();
if(age >= 30 && yearsCitizenship >= 9){
System.out.println("You are Eligible to be a US senator");
}
if(age >= 25 && yearsCitizenship >= 7){
System.out.println("You are Eligible to be a US representative");
}
}
}
Explanation:
Using Java Programming language
The scanner class is used to receive and store the persons age and year of citizenship
The first if statement is used to test if the age >= 30 and citizenship>=9 If this is true, it prints out You are Eligible to be a US senator. You are Eligible to be a US representative. Note that if the second condition is true, then the first is also true because to be eligible for senatorial also means you also meet the requirments for representative position
Answer:
age = int(input("Your age: "))
citizen = int(input("Years of being a US citizen: "))
if age >= 30 && citizen >= 9:
print("You are eligible to US representative and a US senator")
elif age >= 25 && citizen >= 7:
print("You are eligible to be a US representative")
else:
print("You are not eligible to be a US representative or US senator")
Explanation:
Ask the user for its age, and years of citizenship
Check the both inputs:
If age is greater than or equal to 30 and citizen is greater than or equal to 9, it means the person is eligible for US representative and a US senator
If age is greater than or equal to 25 and citizen is greater than or equal to 7, it means the person is eligible for US representative
In any other case, the person is not eligible