# worksheets #1-4 ```if Statement Worksheet #1
1. Assume that the int variable num contains a positive value. Write an if statement that
displays &quot;even&quot; if num is even and &quot;odd&quot; if num is odd.
2. Write an if statement that displays &quot;multiple of 5&quot; if the variable num is a multiple of 5.
3. Write a class named Triplet that
 contains 3 integer instance fields named myNum1, myNum2, &amp; myNum3.
 includes a default constructor that initializes the properties (values of the instance fields)
to zero
 includes an &quot;other&quot; constructor that allows a client to initialize the 3 instance fields
 includes a method named computeMax that returns the largest of the 3 instance fields
 includes a method named computeMedian that returns the median value. For
example, if the values of the three properties are 12, 4, &amp; 7, then the median value is 7.
(You may need to use the back of the page or another page)
These worksheets were originally created by Mr. Minich at Wyomissing HS.
if Statement Worksheet #2
You may use the division and/or modulus operators to examine the individual digits of an integer
in the following exercises. Do not convert numbers to Strings or use loops.
1. Write an if statement that displays the message &quot;ones digit is even&quot; if the variable num is
an even number. You can assume that num is greater than 1.
2. Write an if statement that displays the message &quot;tens digit is odd&quot; if the tens digit of the
variable num is an odd number. You can assume that num is greater than 9.
3. Write an if statement that displays the message &quot;hundreds digit is 5&quot; if the hundreds digit of
the variable num is 5. You can assume that num is greater than 99.
4. Write an if statement that displays the message &quot;thousands digit is 3&quot; if the thousands digit
of the variable num is the number 3. You can assume that num is greater than 999.
5. Write a method named isNumericPalindrome that accepts an integer parameter named
num. If num is a palindrome the method must return true. Otherwise the method must return
false. You can assume as a precondition that num has exactly 5 digits (i.e. it is between 10000
and 99999.) For example, 12321 is a palindrome while 12231 isn't because it's the same number
if reversed.
public boolean isNumericPalindrome(int num)
{
These worksheets were originally created by Mr. Minich at Wyomissing HS.
if Statement Worksheet #3
1. Write an if else if statement that uses a 0-59, 60-69, 70-79, 80-89, 90-100
grading scale to display &quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;, or &quot;F&quot; depending on the value of the integer
variable named testScore. You may assume that testScore is a positive
integer less than 101.
2. Write an if statement that displays &quot;divisible by 3&quot; if the integer variable num is
evenly divisible by 3.
3. Write an if statement that displays &quot;multiple of 5 and 7&quot; if the integer variable num
is a multiple of 5 and 7.
4. Write a method named isPrime that accepts an integer parameter named num. The
method returns true if num is prime. Otherwise it returns false. You can assume as a
precondition that num is less than 100. ((Prime numbers have no prime factors other
than themselves.))
public boolean isPrime(int num)
{
These worksheets were originally created by Mr. Minich at Wyomissing HS.
if statement worksheet #4
Rewrite the following if statements so that any compile (i.e. syntax) and logic errors are fixed
1. if num &gt; 0 System.out.println(&quot;hello&quot;);
2. if (x &gt; Math.pow(y, 2));
System.out.println(&quot;x is greater than y squared&quot;);
3. if (num = 3) System.out.println(&quot;goodbye&quot;);
4. if (3 &lt; num &lt; 10) System.out.println(&quot;over here&quot;);
5. if (num &gt; 5 || &lt; 0) System.out.println(&quot;up there&quot;);
6.