EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Write a complete Java program named Transpose that contains the following:
- The main method asks the user to provide n - the number of rows and m – the number of columns for a rectangular matrix of integers from 2 to 10.
- The main method calls the matrixSetUp() method which creates a rectangular matrix of specified dimensions and populates it with random integers from 0 to 99. Hint: You can use Math.random() to generate random numbers.
- The main method prints the matrix created by the matrixSetUp () method in the form of a matrix. Hint: in order to print the array in the example format, you can use Arrays.toString(matrix[row]) to print each row.
- The main method calls the matrixTranspose() method that creates and returns a transpose of the initial matrix. Hint: matrix transpose means: ����������[���][������]=�[������][���]
- The main method prints the transpose of the matrix.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- JAVA - Multi Dimensional Arrays Ask the user for the number of rows and columns of a two-dimensional array and then its integer elements. Print the row number of the row where the sum of all of its elements is even. For this problem, it is guaranteed that there is one and only one row of such case. Row count starts at 0. Input 1. One line containing an integer for the number of rows 2. One line containing an integer for the number of columns 3. Multiple lines containing at least one integer each line for the elements of the array Sample 2 7 4 1 1 2 0 5 0 Output Note that the row number starts at 0, not 1. Enter # of rows: 3 Enter # of columns: 3 Enter elements: 2 7 4 1 1 2 0 5 0 Even row: 1arrow_forwardPlease use java programming and add comment on each line Thank you!arrow_forwardPlease add comment and use Java Programming to solve this question! Thank you very much!!!! Write a method that sums all the numbers in the major diagonal in an n x n matrix of double values using the following header:public static double sumMajorDiagonal(double[][] m)Write a test program that first prompts the user to enter the dimension n of an n x n matrix, then asks them to enter the matrix row by row (with the elements separated by spaces). The program should then print out the sum of the major diagonal of the matrix.arrow_forward
- In Java Write an application that inputs five numbers, each between 10 and 100, inclusive. As each number is read, display it only if it’s not a duplicate of a number already read. Provide for the “worst case,” in which all five numbers are different. Use the smallest possible array to solve this problem. Display the complete set of unique values input after the user enters each new value. Rough output in screenshotarrow_forwardin javaarrow_forwardJava: Write a complete method to create an array of random integers. Method Specification The method takes in three integer parameters: the array size, the lower bound, and the upper bound. The method also takes in a boolean parameter. The method creates and returns an integer array of the specified size that contains random numbers between the lower and upper bound., using these rules: The lower bound is always inclusive. If the boolean parameter is true, the upper bound is also inclusive. If the boolean parameter is false, the upper bound is not inclusive (meaning it is exclusive). If any of the parameters are invalid, null is returned. Driver/Tester Program I have provided you with a driver/tester program that you can use to test your code before submitting. Paste your code into the placeholder at the top of the file. Review the Homework FAQ page, which contains instructions and a video of how to use the provided file. If you aren't sure how to use the tester or have any…arrow_forward
- Java: Write a complete method to create an array of random integers. Method Specification The method takes in three integer parameters: the array size, the lower bound, and the upper bound. The method also takes in a boolean parameter. The method creates and returns an integer array of the specified size that contains random numbers between the lower and upper bound., using these rules: The lower bound is always inclusive. If the boolean parameter is true, the upper bound is also inclusive. If the boolean parameter is false, the upper bound is not inclusive (meaning it is exclusive). If any of the parameters are invalid, null is returned. Driver/Tester Program I have provided you with a driver/tester program that you can use to test your code before submitting. Paste your code into the placeholder at the top of the file. I strongly recommend running this program before you submit your homework. The program is designed to help you catch common errors and fix them before submitting.…arrow_forwardWrite a method that sums all the numbers in the major diagonal in an n x n matrix of double values using the following header:public static double sumMajorDiagonal(double[][] m)Write a test program that first prompts the user to enter the dimension n of an n x n matrix, then asks them to enter the matrix row by row (with the elements separated by spaces). The program should then print out the sum of the major diagonal of the matrix.arrow_forwardThis code is for java see image thank youarrow_forward
- Please help me with these array questions using javaarrow_forwardI am programming for java and the instructions require for Hi, I am programming in java. The instructions require: Create a new project and call it Project8. Create a dual array 10x10 and initialize it with random numbers, range 0 to 100. Example: int[][] ary = new int[10][10]; Create a method that finds the largest number in the array. Create a method that calculates the sum of a single row. Make the method flexible such that it can calculate the sum of any specified row. Display the sum of each row. I have everything else, I just need the sum of each row. Please keep this simple as possible. Thanksarrow_forwardWrite a program that uses a 2-D array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and highest and lowest temperatures of the year. Your program must consist of the following methods with their appropriate parameters: a.) getData: This method reads and stores the data in the 2-D array. b.) averageHigh: This method calculates and returns the average high temperature of the year. c.) averageLow: This method calculates and returns the average low temperature of the year. d.) indexHighTemp: This method returns the index of the highest temperature in the array. e.) indexLowTemp: This method returns the index of the lowest temperature in the array. Use the following input: High temp for each month: 30 40 45 60 70 90 89 95 79 90 70 40 Low temp for each month: 10 -10 20 30 50 75 85 79 50 80 30 20arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage