Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use Java 'roblem 1: Longest Sorted Sequence LongestSortedSequece.java) Write a Java class named LongestSortedSequence that finds and displays the length of the longest sorted
Please use Java
'roblem 1: Longest Sorted Sequence LongestSortedSequece.java) Write a Java class named LongestSortedSequence that finds and displays the length of the longest sorted subarray for a given array. The dass includes the following methods: 1) longestSortedSequence(): this method accepts an array of integers as a parameter and returns the length of the longest sorted (nondecreasing) sequence of integers in the array For example, in the array (3,8,10,1.9.14.-3.0, 14, 207, 56.98, 12), the longest sorted sequence in the array has four values in it (the sequence-3.0, 14.207), so your method would return 4 if passed this array. Sorted means nondecreasing, so a sequence could contain duplicates. Your method should return of passed an empty array. 2) main() method: Create an integer array from command-line arguments. . Call the longestSortedSequence() method by passing this array, and display the returned results, Outputs: Sjava LongestSortedSequence 38 101914-30 14 200 56 98 The length of the sorted sequence is: 4 Problem 2. Matrix Multiplication (Matrix Multiplication.java) Write a method to multiply two matrices. The header of the method is: public static double[10 multiply Matrix[double (1) a double/10 b) To multiply matrix a by matrix b, the number of columns in a must be the same as the number of rows in b, and the two matrices must have elements of the same or compatible types. For example for two 343 matrices a and b, the resulting matrix c would be: Viego 14 - whereby by+X Write a test program that prompts the user to enter two 3 3 matrices and displays their product. Outputs: Enter matrix : 1 2 3 4 5 6 7 8 9 Enter matrix2:02 41 45 22 1.1 4.35.2 The multiplication result is: [[5.3 23.9 24) [11.6 56,3 58.21 (17.9 88.7 92.41 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started