Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using java please solve 9+10+11 thanks and please read all the information Exercise Material: Arrays, Two-Dimensional Arrays Question 1 (100%) Write a class called ArrayUtils

using java
please solve 9+10+11
thanks
and please read all the information image text in transcribed
image text in transcribed
image text in transcribed
Exercise Material: Arrays, Two-Dimensional Arrays Question 1 (100%) Write a class called ArrayUtils that supports a collection of arrays. Realize the following static methods: 1. A method that takes an array of integers and returns a representation of its string. If arr is null, the method returns null. Signature method: public static String toString (int arr) Examples: for array {3, 2, 1} = arr The method will return the string: "(3, 2, 1) for array {} (i.e. an empty array with O members The method "h" is returned. 2- A method that accepts an array of integers and returns a new array whose members are the absolute values of the array obtained. If arr is null, the method returns null. Signature method: public static int ( absArray (int ) arr) Examples: for the array {3, 2, 1) = arr The method will return the array: {3, 2, 1} for the array f (i.e. an empty array with O Organs) will be returned an empty array. 3- A method that receives an array of integers and a val value and changes the array so that it puts the value val in each cell in the array. If arr is null or empty, the method does nothing. Signature of the method: public static void fill (int i) arr, int value) Example: for the array {3, 2, 1} = arr and the value o = value, after running the method arr the array will be: {0, , ] 4. A method that gets an array of integers, a val value and two indices of beginning and end. The method changes the resulting array so that it puts the val value in all cells between start and end (including the beginning, not including the end). The method does not change the array arr if arr is null or empty or one of the indexes is invalid (valid index Is an index within the boundaries of the array only). In addition, if the start is large or equal to the end the method does not change the array, Signature method: public static void fill (int] arr, int value, int start, int end) Example: for array {7, 4, 3, 2, 1} = value = 0, start = 1, end = 3, arr After running the arr method the array will be: 7,4-0, 0, 1) Exercise No. 6 Study material for the exercise: Loops, Characters, Strings Question 1 (100%) In the exercise use only the methods learned in the practice should be used, and in particular only the methods charAt().indexOf().length ().equals. Do not use additional String class methods. The code examples from the exercise will help you in some of the tasks in this exercise. write a department called Limited Sentence which represents a sentence in English. Class Constraints There is a collection of constraints on the sentences that the class represents and the legal words in language 1. The sentence is an empty string or contains only English letters (i.e., no numbers or other additional characters). 2. The sentence consists of words that have a delimiter between them. 3. The separating character does not open a sentence or end a sentence. 4. The character is not a letter in English. Any other character can be a separator character. 5. The length of the sentence is up to 25 characters (i.e. the cumulative length of words + separating characters will be 25 characters at most, including 25). Hint: magic number. Fields The class contains two private fields: a. Sentence - the sentence that the class wraps (of the String type) b. delimiter - a character that separates the words (of type char) Builders 1. Empty default builder. This constructor initializes the separator to be a space and the string to be an empty string. Builder's signature: public Limited Sentence ( 2. A builder who receives a character separates and initializes the sentence to be an empty string. If the character is invalid, we will initialize the separator to be a space. Builder's signature: public Limited Sentence (char delimiter) 3. A copy builder who creates a copy of the object. Builder's signature: public Limited Sentence (Limited Sentence other) Methods The class supports the following methods: Note: If the maximum value appears in the array more than once, the indexes will be returned for its first appearance. Examples:. For the array {{0, 9, 16} {2, 4, 1}}, the maximum number is 16, which is in the second row (index 1) and the first column (index 0). Therefore the array will be returned: For the array {{16, 9, 16}, {2, 4, 1}}, the maximum number is 16, which is in the second row (index 1) and the first column (index 0) and also in the second row and the last column. Therefore the array will be returned: {0, 1} 11. A method which accepts two two-dimensional arrays and returns a new two-dimensional array which is their sum. If one of the parameters is null or the arrays do not have the same dimensions, return null. Note: Assume that the number of columns is the same in all rows of tablel, and the same is true of table2 (however, the dimensions of tablel cannot be assumed to be equal to the dimensions of table2). Signature method: public static int 0 sumTables (int 0 0 tablel, int 0 table2) Example: for the parameters int 0 0 tablel = {{1, 4}, {16, 0}} int 0 0 table2 = {{0, 6}, {4,9}} The array is returned: {{9, 20}, {10, 1}} 1: 9, 20). {1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions