NOTE: You must include commenting in all of these assignments. The code must be neatly formatted marks will be deducted. Part A: This question is to be submitted to the instructor in the form of a Word (or Open Office) document containing the Java code and appropriate screen capture(s) of the output. The file name must be in the form ASSIGN5A_YourName where YourName is your last name followed by your first name with no space. Upload the file to CMS. Problem 6.9, page 256 Version 1: Solve the problem as written in the textbook. Demonstrate that it works using 3 different arrays (1 screen shot for each). Problem 6.7, page 256 You may find the ternary operator useful when you need to add the s to the word times. Example of pluralizing question would be S.O.P(question + (numQuestions>1?s:); Run the program three times providing screenshots for each run. Problem 7.5, page 282 Test using the matrix in the chapter and another matrix of different size with double values. (A minimum of 2 screen captures required.) Part B: Write code and test the solutions for the following problems from the textbook. Submit the .java files for each question to CMS. Problem 6.5, page 261 Problem 6.27, page 261 Include the method in a test application which uses the method. Problem 7.13, page 285 Problem 7.25, page 290 Be prepared to answer questions about how the program works. If you cant explain how it works, your grade will be impacted. 6.9 ( ) Write a method that finds the smallest element in an array of double values using the following header: min( [] array) Write a test program that prompts the user to enter ten numbers, invokes this method to return the minimum value, and displays the minimum value. Here is a sample run of the program: 2 Enter ten numbers: The minimum number is: 1.5
6.7 ( ) Write a program that generates 100 random integers between 0 and 9 and displays the count for each number. ( : Use to generate a random integer between 0 and 9. Use an array of ten integers, say , to store the counts for the number of 0s, 1s, , 9s.) 7.5 ( ) Write a method to add two matrices. The header of the method is as follows: [][] addMatrix( [][] a, [][] b) In order to be added, the two matrices must have the same dimensions and the same or compatible types of elements. Let be the resulting matrix. Each element + For example, for two 3 * 3 matrices and , is Part b 6.5 6.27 ( ) The arrays and are if they have the same contents. Write a method that returns if and are identical, using the following header: equals( [] list1, [] list2) Write a test program that prompts the user to enter two lists of integers and displays whether the two are identical. Here are the sample runs. Note that the first number in the input indicates the number of the elements in the list 7.13 ( ) Write the following method that returns the location of the largest element in a two-dimensional array. [] locateLargest( [][] a) The return value is a one-dimensional array that contains two elements. These two elements indicate the row and column indices of the largest element in the two-dimensional array. Write a test program that prompts the user to enter a two-dimensional array and displays the location of the largest element in the array. Here is a sample run: 7.25 ( ) An matrix is called a if each element is positive and the sum of the elements in each column is 1. Write the following method to check whether a matrix is a Markov matrix. isMarkovMatrix( [][] m) Write a test program that prompts the user to enter a matrix of double values and tests whether it is a Markov matrix. Here are sample runs: