Ask Question

A person is eligible to be a US senator if they are at least 30 years oldand have been a US citizen for at least 9 years. To be a US representativethese numbers are 25 and 7, respectively. Write a program that accepts aperson's age and years of citizenship as input and outputs their eligibilityfor the Senate and House.

+5
Answers (2)
  1. 13 June, 20:44
    0
    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
  2. 13 June, 21:01
    0
    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
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “A person is eligible to be a US senator if they are at least 30 years oldand have been a US citizen for at least 9 years. To be a US ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers