Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a.Pick one of the following conditions that have not been chosen by someone else

ID: 3591403 • Letter: A

Question

a.Pick one of the following conditions that have not been chosen by someone else, and write the code that would perform the condition.

b.Write a condition that will return the value True if:

i.The value stored in variable aInteger is greater than the sum of the values stored in bInteger and cInteger.

ii.The name stored in variable lastNameString starts with the letter “A”.

iii.The textbox numberTextBox contains a valid number between 1 and 100.

iv.The checkbox memberCheckBox is not checked.

v.One of the Boolean variables aBoolean and bBoolean is true, but not both.

vi.The variable aInteger is less than the variable bInteger, which is less than the variable cInteger.

vii.The variable lastNameString is not blank.

viii.The integer variable aInteger is less than the decimal variable bDecimal.

ix.The integer variable aInteger is less than the string variable bString

Explanation / Answer

i.The value stored in variable aInteger is greater than the sum of the values stored in bInteger and cInteger.
if(aInteger > bInteger + cInteger)
   return true;
return false;
  
ii.The name stored in variable lastNameString starts with the letter “A”.
if(lastNameString[0] == 'A')
   return true;
return false;
  
iii.The textbox numberTextBox contains a valid number between 1 and 100.
if(numberTextBox >= 1 && numberTextBox <= 100)
   return true;
return false;
  
iv.The checkbox memberCheckBox is not checked.

v.One of the Boolean variables aBoolean and bBoolean is true, but not both.
if((aBoolean && !bBoolean) || (bBoolean && !aBoolean))
   return true;
return false;

  
vi.The variable aInteger is less than the variable bInteger, which is less than the variable cInteger.
if(aInteger < bInteger && bInteger < cInteger)
   return true;
return false;