Search 74,114 tutors
FIND TUTORS
Ask a question
0 0

Help writing this program homework

Presidential Eligibility Article II, Section 1, Clause 5 of the Constitution of the United States, states that "No Person except a natural born Citizen, or a Citizen of the United States at the time of the Adoption of this Constitution, shall be eligible to the Office of President; neither shall any Person be eligible to that Office who shall not have attained to the Age of thirty five years, and been fourteen Years a Resident within the United States. Write a program that determines if a person is eligible to run for president of the United States in 2016 (Note: A natural- born citizen is a person who is born within the jurisdiction of the U.S. government. A 2016 candidate for president must achieve age 35 by Inauguration Day, 1/20/2017.)  Hint: Use the AddYears method.
Tutors, please sign in to answer this question.

1 Answer

Inputs needed:  date of birth, date of US residence, date of US natural born citizenship, current date
 
Calculate age on 1/20/2017
If age<35 then not eligible
 
if not natural born citizen, then not eligible
 
calculate years of residence
if <14 then not eligible
 
else eligible