
2D Array Operations
Write a
- getTotal. This method should accept a two-dimensional array as its argument and return the total of all the values in the array.
- getAverage. This method should accept a two-dimensional array as its argument and return the average of all the values in the array.
- getRowTotal. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the specified row.
- getColumnTotal. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The method should return the total of the values in the specified column.
- getHighestInRow. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the highest value in the specified row of the array.
- getLowestInRow. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should he the subscript of a row in the array. The method should return the lowest value in the specified row of the array.
Demonstrate each of the methods in this program.

Want to see the full answer?
Check out a sample textbook solution
Chapter 7 Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Management Information Systems: Managing The Digital Firm (16th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out With Visual Basic (8th Edition)
- For the following truth table: a) Write the canonical SOP. Row × Y Z F 0 0 0 0 0 b) Write the canonical POS. | 0 0 1 2 0 1 0 1 3 0 1 1 0 4 1 0 0 0 5 1 0 1 1 6 1 1 0 0 7 1 1 1 1arrow_forward(团) (四) The Dog class has a constructor that takes two parameters. The first parameter is a String representing a dog's name and the second parameter is an int representing the dog's age, in months. 9 Mark for Review ARC The following code segment appears in a class other than Dog. Which of the following best describes the contents of dog1 and dog2 as a result of executing this code segment? Dog dogl new Dog ("Rex", 4); Dog dog2 dogl dog1; new Dog("Fido", 60); dog1 and dog2 are Dog variables that each contain the same Dog object, which represents a dog named "Fido' that is 60 months old. dogl is a Dog variable that contains a Dog object representing a dog named "Fido" that is 60 months old, and dog2 is a Dog variable that contains a Dog object representing a dog named "Rex" that is 4 months old. dogl and dog2 are Dog reference variables that each contain a reference to the same memory address that contains the Dog object representing a dog named "Fido' that is 60 months old. dogl is a…arrow_forwardThe following code segment is intended to assign to newword the result created by removing the first occurrence of "a" from word. Assume that the String variable word has been properly declared and initialized. This code segment works for some, but not all, values of word. int aLoc word.indexOf("a"); String newword word.substring(0, aLoc) + word.substring(aLoc + 1); 18 Mark for Review Which of the following conditions best describes the condition in which this code segment will not work a intended and will result in a runtime error? is the first character in word. is the last character in word. word does not contain the character "a". word contains only a sequence of multiple "a" characters.arrow_forward
- Consider the following code segment, which is intended to create a String that consists of the last character in word and assign it to the variable lastChar String word / initialization not shown */; // line 1 int len word.length(); // line 2 String lastChar word.substring(len); // line 3 17 Mark for Review Which of the following best describes why this code segment will not work as intended? substring needs to be called with two parameters, so the method call in line 3 should be changed to word.substring(len, len + 1). len is not the correct index of the last character in word, so the method call in line 3 should be changed to word.substring(len - 1). len is not the correct index of the last character in word, so the method call in line 3 should be changed to word.substring(len + 1). substring cannot be called with a variable as the parameter, so the method call in line 3 should be changed to word.substring (word.length()). ABCarrow_forwardConsider the following code segment. String one String two "computer"; "science"; String concat / missing code */; System.out.println(concat); 2 16 Mark for Review ARC Which of the following expressions can be used to replace/missing code / so that the code segment prints the string "pun"? one.substring(3, 4) + two.substring(4, 4) one.substring(3, 5) + two.substring(4, 5) one.substring(4, 5) + two.substring(5, 5) one.substring(4, 6) + two.substring(5, 6)arrow_forwardPlease R show code and output for the following questions.arrow_forward
- Go through Chapters 2-4 of the 9th edition of Foundations of Information Systems: What do you like or not like about the student registration process? Do you believe that a university should be allowed to monitor emails sent and received on the university computers? Why or why not? Support your answer. Is security a technical issue? A business issue? Both? Support your answer.arrow_forwardThank You Computer SciencePlease provide source code in C and also the state diagram in drawing form not text Design a state diagram to recognize one form of the comments of the C- based programming languages, those that begin with /* and end with */. Submission: a state transition diagram (no source code required) specifying all necessary components.arrow_forwardHello, Mistakely submitted blurr image please skip otherwise unhelpful. Computer science.arrow_forward
- Mistakely submitted blurr image please skip otherwise unhelpful. Computer science.arrow_forwardSubject = Computer Science i mistakely submitted blurr image please skip it.arrow_forwardOR AND Neg-AND D A Output D A Output B D Output AB Output AB Output AB Output AB 00 01 10 00 00 01 10 10 11 NOR 11 10 |1|1 NAND Neg-OR B A Do A Output B Do A Output Output B AB Output AB Output AB Output 00 00 00 01 01 01 10 10 10 11 |11 XOR XNOR NOT A Output Output Output B B AB Output AB Output A Output 00 00 01 01 0 1 10 10 11 |1|1arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning




