Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In most of these, the method should accept the required pieces of data as arguments and return the result. Input and output should probably
In most of these, the method should accept the required pieces of data as arguments and return the result. Input and output should probably not occur in your solutions; input and output would likely occur in the method that calls your method! 1. Write a method that computes the average of an array of integers. a. A harder version of this problem is to return the median instead. 2. Write a method that returns the 4th largest of an array of integers. 3. Write a method that will encrypt a string using the Caesar encryption method. The encryption method requires a key (an integer between 0 and 25 or -1 to-25). This key is the amount to shift each letter in the string; other symbols remain unaffected. For example, if the string were "silly words. 12 of them." and the key were 2 then the encrypted string would be "uknna yqtfu. 12 qh vigo." Notice that if the shift goes beyond the letter 'z' then you wrap around to "a" again. 4. Write a method to determine if a string is a palindrome. A palindrome is a phrase that when spelled backwards is the same as forwards. Note: How to handle punctuation? Write a method that determines if a number is a palindrome. Note: do not use strings. Write a method that will compute the next value in a funny mathematical series. The next value in the series is the sum of the squares of the digits of the current value in the series. For example, if the current value is 89 then the next value is 8+92-145. 5. 6. 7. Write a method that returns the distinct characters that can be found in a string argument. a. Variations to this question include: returning how many distinct characters instead and making your solution case insensitive. 8. Write a method that accepts two strings as parameters and returns a third string containing the characters that are in the first string but not in the second. First String Second String " "abba "silly" "what" "silly" "ice" "silly" "ice "cat" "dog" 9. Write a method that accepts two strings as parameters and returns a count of the number of characters that are in the first string but not the second string. First String Second String "bill" "abba" "silly" "bill" FFF "what" "silly" "ice "cat" 11 "bill" "bill" *** "ice" "silly" "dog Result waa 11 11 -11 "what" "slly" ce" cat" Result 2 2 4 4 2 10. Solve questions 8 and 9 again, but this time make sure that all of the characters are distinct.
Step by Step Solution
★★★★★
3.44 Rating (154 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started