You are writing a program that needs to test whether a candidate is eligible to
ID: 3581197 • Letter: Y
Question
You are writing a program that needs to test whether a candidate is eligible to run for president. The requirements are that the candidate needs to be at least 35 years old and an American citizen. You have an integer variable representing the candidates age and a boolean value representing whether they are a citizen. Which of the following expressions will return true if a candidate is eligible to run and false otherwise? if (age == 35 && citizen) if (age == 35 || citizen) if (age >= 35 && citizen) if(age >=35 || citizen) if(age > 35 && |citizen) I have no ideaExplanation / Answer
3) if (age >= 35 && citizen)
This condition defines the problem correctly
As the age is greater than or equal to 35
and writing only "citizen" in the condition will only be true if citizen=1
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.