Note: This homework is a review to the content covered in Programming 1. You might want to use the method Integer.parseInteger(), Character isDigit, Character.isLetter() although the problems could be efficiently solved without using any of these methods. Refer to the solved problem on the next page for reference Problem 1) Write a method that counts the number of digits in the taken String. The method's header is as follows. public static int countDigits(String s) Example: s = "H0145ELLO#$%"; int count = countDigits(s); // count = 4 Problem 2) Write a method that counts the number of non-letter characters in the taken String. The method's header is as follows. public static int countNonLetter(String s) Example: s = "H0145ello #$%"; int count = countNonLetter (s); // count - 8 Problem 3] Write a method that returns the sum of odd numbers in the taken String. The method's header is as follows: public static int sumOfDigits(String s) Example: s="H0145ello #S%"; int sum = sumDigits(s); // sum- 6 Problem 4) Write a method that takes a String and returns an array of characters. The returned array stores the string's characters in reversed index order. The method's header is as follows: public static char[] toCharArray(String s) Example: s="Java SE 13": char[out -toCharArray(); {'3','1',,'E', 'S','* out Problem 5) Write a method that takes a String and returns a Boolean value. The method returns true if all the digit characters in the taken string are odd and larger than 4, false otherwise. Solved problem Write a method that takes a String and returns a boolean value. The method returns true if all the digits in the taken string are even, false otherwise. 1 2 3 4 S public class Assignments { public static void main(String[] args) { System.out.println(isValidString("H101248648">); System.out.println(isvalidstring("H184248648")); } // false // true 7 public static boolean isValidString(String s) { B char c; 9 for (int ke; k
' 88 CC '9' && (int)(c = '0') % 2 = 1) { 12 return false; 13 } 14 > 15 return true; 16 ) 17 ) 18 19 // (int) ( - 'D'): converts the digits character into the corresponding int value 20 // 'e' > 0, '11, 'S' 5, etc. 21 22 // Note: in the above example, if you replace (int)(c - '') with (C- ''), the code 23 // will still provide the correct result. Can you explain why