clipse w Help Algorithms1. ProblemSet ProblemSet.. ProblemSet mSet.. DProblemSet
ID: 3741348 • Letter: C
Question
clipse w Help Algorithms1. ProblemSet ProblemSet.. ProblemSet mSet.. DProblemSet. *? q3: Write a public static method named q3 that takes no parameters and returns a new * HashMap with keys of type String mapped to values of type Integer containing the key-value * pairs ("hero":36, "blind":17, "awareness": -16, "mixture":7) 43 : parameter and returns an int. The returned int should be the sum of the values in the : input Arraylist at indices 17, 3, and 11. You can assume the input Arraylist has size " large enough to avoid an index out of bounds exception at these indic 45 47 q5: Write a public static method named q5 that takes two doubles as parameters and returns a double. The returned double should be the the sine of the first input subtracted by the s the tangent of the second input . See (https://docs.oracle.com/java se/8/docs/ap1/java/lang/Math.html #method. sumary) for a - complete list of methods contained in the Math class. You may call any of these methods in your sethod 58 63Explanation / Answer
public static HashMap q3() { HashMap map = new HashMap(); map.put("hero", 36); map.put("blind", 17); map.put("awareness", -16); map.put("mixture", 7); return map; } public static int q4(ArrayList list) { return list.get(17) + list.get(3) + list.get(11); } public static double q5(double n1, double n2) { return Math.sin(n1) - Math.tan(n2); }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.