1.      Problem 1
Design and implement an application that reads an arbitrary number of integers that are in the range 0 to 50 inclusive and counts how many occurrences of each are entered. After all input has been processed, print all of the values (with the number of occurrences) that are entered one or more times. (Hint: can use idea from LetterCount program in the book)

2.      Problem 3
Write a method named summit that accepts 2 integer arrays named gamma and delta. If the arrays are the same size the method will return an array of the sum of the corresponding elements. If they are of different sizes the method will return an array of 10 elements where all of the elements are set to -1. (Obviously, you need to put this method in a class and create an application to generate output.)

Create a class named ArrayMethods. No attributes. No Constructor (System will supply it). Implement the following methods which all take an integer array named list as a parameter:

3.      The method named setup that will initialize all of the odd elements to -1 and set the even elements to their index number.

4.      The method named fibo will initialize the array to the Fibonacci sequence. This sequence starts with 1 and 2 as the first 2 elements and each element thereafter is the sum of the previous two elements. (1, 2, 3, 5, 8, 13



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *