Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this problem set, you will submit a single java file named Homework.java. You are supposed to add the functions described below to your Homework
For this problem set, you will submit a single java file named Homework.java. You are supposed to add the functions described below to your Homework class. The functional signatures of the functions you create must exactly match the signatures in the problem titles. You are not allowed to use any rd party libraries in the homework assignment nor are you allowed to use any dependencies from the java.util package besides the Pattern Class. When you hava completed your homework, upload the Homework.java file to Grader Than. All tests will timeout and fail if your code takes longer than seconds to complete. privateFunctionThis is a private nonstatic function that takes no arguments and returns an integer.You don't need to put any code in this function, you may leave the function's code empty. Don't overthink this problem. This is to test your knowledge on how to create a nonstatic private function.Arguments:returns int You may choose any integer you would like. protectedFunctionString intThis is a protected nonstatic function that takes a String and an int as its arguments and returns nothing.You don't need to put any code in this function, you may leave the function's code empty. Don't overthink this problem. This is to test your knowledge on how to create a nonstatic protected function.Arguments:String text An stringString int An integer countOccurrencesString StringThis is a public static function that takes a String and a string for the parameters and returns an int.This function should count the number of times a given pattern the second parameter is found within each string in an array of strings first parameter Then the function should return the total number of occurrences. Arguments:String array An array containing at least one stringString pattern A string containing at least one character.returns int The number of times the pattern is found in the strings in the array. Example:array aba "ckel", "kealska"pattern aoutput mergeAndRemoveint intThis is a public static function that takes a int and int for the parameters and returns an intGiven two arrays of integers. Your job is to combine them into a single array and remove any duplicates, finally return the merged array. Arguments:int array An array of integersint array An array of integersreturns int An array of integers containing the unique values from both array and arrayExample: arrayarrayoutput pairRemovalString String, StringThis is a public static function that takes three Strings as arguments and returns a String.You will be given three strings, the first string is a sentence known as text that contains at least one occurrence of left pattern and right pattern. The second and third arguments of the function are the left and right patterns respectively. Left pattern and right pattern are single characters strings that you are attempting to remove from the string. Your goal is to remove only the patterns when the left pattern has an equal number of corresponding right patterns. The patterns are removed in pairs only when there is a balanced number of left and right patterns. The patterns may be nested within the text and there is no guarantee that a left pattern will occur before the right pattern. Arguments:String text The string with the substring to be removedString leftPattern A pattern that the substring must start withString rightPattern A pattern that the substring must end withreturns String The given text with the paired patterns removedExample:Example : text Muscat mecum tollgate poultry quarrymen pantheon asteria leftPattern rightPattern return Muscat mecum tollgate poultry quarrymen pantheon asteriaExample : text merioneth smickly helotage yarr ethmoidal digitinervateleftPattern rightPattern return merioneth smickly helotage yarr ethmoidal digitinervateExample : text southland palladic pasillo seeableness normanesqueleftPattern rightPattern return southland palladic pasillo seeableness normanesque multiplyMatricesint intThis is a public static function that takes two D array's int also known as matrices and returns the dot product of the two matrices. In other words this function is suppose to multiply the matrices it receives and return the product. For more information on how to multipy a matrices please recieve this tutorial. You can expect the number of columns in the first matrix to be the same number of rows in the second matrix.Arguments:int matrixA An n x m matrix int matrix An p x n matrix returns int The product matrix.Examples:Matrix A: Matrix B: Output: Matrix A: Matrix B: Output: Matrix A: Matrix B: Output: Matrix A: Matrix B: Output:
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