Program L8a Solution

$35.00 $29.00

Get Chapter8_FillInTheCode.java . Code the answers in java in the provided file. Go to section 8.11.2 (page 546) and read problem #25. In a text document, explain what this method does. Do the same for problem #26. Answer the following question: “Is the else block inside the for loop needed? Justify your answer” Download the…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:
Tags:

Description

5/5 – (2 votes)
  1. Get Chapter8_FillInTheCode.java . Code the answers in java in the provided file.

  1. Go to section 8.11.2 (page 546) and read problem #25. In a text document, explain what this method does.

  2. Do the same for problem #26. Answer the following question: “Is the else block inside the for loop needed? Justify your answer”

  3. Download the code from L8a.zip and complete the following exercises. When finished submit BOTH files for grading.

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

    1. 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.

      1. 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

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

  1. array that has all elements that are 90

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

Program L8a Solution
$35.00 $29.00