#Conditionals
###Resources If-then/If-then-else
Complex conditionals/combining boolean expressions
###Exercises
- Write a method
isOdd
that takes in anint
n. Returns atrue
if n is odd, andfalse
otherwise.- Write a method
isMultipleOfThree
that takes in anint
n. Returnstrue
if n is a multiple of three, andfalse
otherwise.- Write a method
isOddAndIsMultipleOfThree
that takes in anint
n. Returnstrue
if n is both odd and a multiple of three, and false otherwise.- Write a method
isOddAndIsMultipleOfThree2
- if you usedisOdd
andisMultipleofThree
in your last solution, don't use it this time. If you did not, write this method building on your last methods.- Write a method
fizzMultipleofThree
that takes in anint
n and prints "Fizz" if n is a multiple of three, and prints n otherwise.
Look at Person.java from the assessment.
- Write a method that takes in a
Person
and returnstrue
if the person is from London, andfalse
otherwise.- Write a method that takes in a
Person
and prints the name if the person has a name longer than 5 characters, and otherwise prints "Name is too short."