Answered step by step
Verified Expert Solution
Question
1 Approved Answer
COMPLETE THE AREAS HIGHLIGHTED (Java) It is part of a JUnit assignment. All lines of code must be completed to have the code run properly.
COMPLETE THE AREAS HIGHLIGHTED (Java) It is part of a JUnit assignment. All lines of code must be completed to have the code run properly.
JUO9V.java Wednesday, January 6, 2021, 1:18 PM 1 /** 2 * Name: Firstname and Lastname This goes with chapter 5 and deals with String 3 * methods and some math. You are not allowed to use any non subset methods to 4 * solve these. 5 * @version 2.0 - fixed -0.0 root issue. 6 * 7 * @author Firstname and Lastname 8 */ 9 10 public class JUO9V 11 12 13 /** 14 * This method accepts a number as parameter and then 15 * creates a sentence in the form of "The square root of 9 is 3.0" or 16 * "The square root of 100 is 10.0" 17 * @param number >= 0 18 * @return see above 19 */ 20 public static String squareRootSentence int number 21 22 String response 23 //TODO: Add code here to make the tests pass. 24 return response; 25 26 27 /** 28 * This method accepts a number as parameter ar hen 29 * creates a sentence in the form of "9^2 == 81" 30 31 * @return see above 32 */ 33 public static String exponentSentence int base, int exponent 34 Page 1 JUO9V.java Wednesday, January 6, 2021, 1:18 PM 35 String response = " 36 //TODO: Add code here to make the tests pass. 37 return response; 38 39 40 /*** 41 * Create a method that builds a sentence with the name and phrase that the 42 * person shouts. shout("Grace", "Java") -> Grace loves to shout the phase 43 * "Java"! 44 45 * @param name 46 * @param phrase 47 * @return 48 */ 49 public static String shout String name, String phrase 50 51 return "Fix this so that it passes the tests" 52 53 54 /** 55 * Build a computer file path given the drive letter, the main folder name, 56 * and the filename. Examples: 57 58 *59 * getFilePath("C", "Documents", "rap.mp3") 60 *61 62 * @param driveLetter 63 * @param mainFolder 64 * @param fileName 65 * @return 66 */ 67 public static String getFilePath String driveLetter, String mainFolder, * Page 2 JU9V.java Wednesday, January 6, 2021, 1:18 PM String fileName * 70 return "Fix this so that it passes the tests"; 71 72 73 /** 74 * Unlike the Java built-in Math.sqrt method, GoodSqrt can return imaginary 75 * numbers. If you haven't completed Algebra II, don't worry. When you take 76 * the square root of a negative number, just remove the negative before you 77 * square root it. Then concatenate an "i" to the end of it. Examples 78 79 *
80 * epicSqrt(25) -> "Square root of 25 is 5.0" 81 * epicSqrt(-25) -> "Square root of -25 is 5.0i" 82 * epicSqrt(-16) -> "Square root of -16 is 4.0" 83 * epicSqrt(16) -> "Square root of 16 is 4.0" 84 *85 86 * @param age 87 * @return 88 */ 89 public static String epicSqrt int value 90 91 return "Fix this so that it passes the tests"; 92 93 94 95 96 97 98 /*** 99 * Given 2 strings, return their concatenation, except dump the first char of 100 * each. The strings will be at least length 1. * Page 3 JUO9V.java Wednesday, January 6, 2021, 1:18 PM * * 101 102 *
103 * noFirstLetterConcat("Hello", "There") -> "ellohere" 104 * noFirstLetterConcat("java", "code") -> "avaode" 105 * noFirstLetterConcat("shotl", "java") -> "hotlava" 106 *107 108 * @param word1 109 * @param word2 110 * @return 111 */ 112 public static String noFirstLetterConcat String word1 String word2 113 114 // TODO: Finish 115 return "42" 116 117 118 /*** 119 * Creates a string that displays the first position of the letters a, e, i, 120 * o, and u in sentence. If a vowel is not located, it will report -1 as the 121 * position. Hint: use indexOf to simplify things. 122 123 *
124 findVowels("appleapp") would return 125 The first position of a is 0. 126 The first position of e is 4. 127 The first position of i is -1. 128 The first position of ois -1. 129 The first position of u is -1. 130 *131 132 * @param sentence 133 != null and lowercase 134 * @return * * * * * Page 4 JUO9v.java Wednesday, January 6, 2021, 1:18 PM 135 */ 136 public static String findVowels String sentence 137 138 return "TODO: Write the body of this method so the test passes." 139 140 141 142 143 144 145 Page 5
Step by Step Solution
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