cs113_s09_04_select

cs113_s09_04_select - PRACTICE 04 0 Given the following...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
PRACTICE 04 0 ) Given the following: int a = 5, b = 6, c = 7, d = 8; boolean flag = a == b - 1; Evaluate true or false 1. 2. 3. !flag || flag || c == a + 2 4. 5. true || false == flag || !flag 1) Implement a method named isBig that will accept one string parameter named alpha . It will return true only if the length of the string is greater than 6 . 2 ) Implement a method named oddEven that takes one String parameter named ‘ message’ . The method will return the middle character if the string has an odd length, or the first and last characters if the string has an even length. Example: If message is “tubular” return u -------- If message is “boxing” return bg 3 ) Implement a method named looks that accepts 2 integer parameters named width , length It will return the string “skinny” if the length is more than twice the width. If the width is more than twice the length, it will return the string “fat”. If they are the same it will return the string “square”.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online