QuestionQuestion

Transcribed TextTranscribed Text

Eligibility for US Congress “No Person shall be a Representative who shall not have attained to the Age of twenty five Years, and been seven Years a Citizen of the United States” 1 “No Person shall be a Senator who shall not have attained to the Age of thirty Years, and been nine Years a Citizen of the United States” 2 1. Create the classes as shown in the UML. Note: both Senators and Representatives are “members of Congress.” 2. CongressEligibility class: a. The no-arg constructor should call the 2-arg constructor, passing 0s. b. The 2-arg constructor should call the setters. c. In the two setters, validate the arguments: the age and yearsCitizen must be non-negative, and the yearsCitizen must be less than or equal to the age. If the arguments are invalid, do not change the class variable. d. The methods returning boolean will use the rules from the constitution, quoted above the UML diagram. e. There are two pairs of overloaded methods. In each pair, the non-static method should call the static method. Pass the required values, and return the boolean value. 3. CongressEligibilityMain class: a. Create a variable of the CongressEligibility class. 1 Article I, section 2, US Constitution 2 Article I, section 3, US Constitution b. Prompt the user for their age and the length of time they have been citizens. See the Sample Run below. c. Prompt for both inputs before doing any other processing. d. Set the values for the CongressEligibility object. e. Use the object constructed above and an if - else - if structure to print one (and only one) of the following: i. You are eligible to be a member of the House or the Senate. ii. You are eligible to be a member of the House. iii. You are not eligible to be a member of Congress. Sample Run (user input is red bold) Please enter your age: 27 How long have you been a citizen of the US: 27 You are eligible to be a member of the House.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

/*
* CongressEligibility class
* - Checks if person is eligible to be in Congreess
*/
public class CongressEligibility {
   
    /*
    * Field variables
    */
    // age of person
    private int age;
    // years that person has been citizen
    private int yearsCitizen;
   
    /*
    * Static class variables
    */
    // Minimum age to be in House of Representatives
    public final static int MIN_AGE_HOUSE = 25;
    // Minimum age to be in Senate
    public final static int MIN_AGE_SENATE = 30;
    // Minimum number of years a person must be a citizen to be in House of Representatives
    public final static int MIN_CITIZEN_HOUSE = 7;
    // Minimum number of years a person must be a citizen to be in Senate
    public final static int MIN_CITIZEN_SENATE = 9;
   
    /*
    * Constructor without arguments
    */
    public CongressEligibility() {
       this(0, 0);
    }
   
    /*
    * Constructor with arguments
    * @param age int age of person
    * @param yearsCitizen int years that person has been citizen
    */
    public CongressEligibility(int age, int yearsCitizen) {
       setAge(age);
       setYearsCitizen(yearsCitizen...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$45.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats