CS110 Programming Assignment 7

Instructor: Trish Cornez


Loops and Basic Arrays




PROGRAM 1



Write a Java program that tests the method ridFives().
ridFives() receives an integer array of any size and returns a version of the given array where all the 5's have been removed. The remaining elements should shift left towards the start of the array as needed, and the empty spaces at the end of the array should be 0.
Perform the following tests:

PROGRAM 2



Write a Java program that tests the method hasValues().
hasValues() receives two integer arrays, both sorted in increasing order, big and little. Code hasValues() so that it returns true if all the numbers in little appear in big and false otherwise.
Perform the following tests:

PROGRAM 3



Write a Java program that tests the method countAdjacent().
countAdjacentSeries() receives an integer array, of random values and returns the number of adjacent series in the given array. For example, an adjacent series is 1, 2, 3, 4.
Perform the following tests:

PROGRAM 4



Write efficient code to create a two-dimensional array containing the 20 rows and 20 columns of a multiplication table from 1 to 20. See the image below. Only print your code.