Starting from:
$35

$29

Program L8a Solution

    1. Get Chapter8_FillInTheCode.java . Code the answers in java in the provided file.

    2. Go to section 8.11.2 (page 546) and read problem #25. In a text document, explain what this method does.
    3. Do the same for problem #26. Answer the following question: "Is the else block inside the for loop needed? Justify your answer"
    4. Download the code from L8a.zip and complete the following exercises. When finished submit BOTH files for grading.

        a. Implement the methods that are declared as skeletons in ArrayMethodsL8a class. See javaDoc and sample run.

        b. Implement a "business" method that returns the sum of all the elements of an array of ints that are at even index. Call your method from the client.
            c. Implement a "business" method that based on the content of the instance variable intArray creates an array of booleans, assigning true for any element of the intArray array greater than or equal to 100; and false otherwise. It returns the booleans array to the client.

For example, if the intArray had elements: 12, 125, 3, 100, 250, and 5 the new array's

elements would be: false, true, false, true, true, and false


Make sure that the client prints the content of the received boolean array.

In the service class use the following signature for your method: public boolean [ ]

toBoolean()

In the client you would call the method as something like: boolean [ ] intAsBoolean =

arr.toBoolean();

and you would write a for loop to print the content of the intAsBoolean array.

d. Implement a "business" method that returns the percentage of elements greater than or equal to 90 in an array of ints.
To properly test your method you need to define three different arrays in your client:

    1. array that does not have any elements of 90

    2. array that has more than one element that is 90

    3. array that has all elements that are 90



https://cilearn.csuci.edu/courses/5532/assignments/61973    1/1

More products