Solution:
The output is Sizes:223.
Explanation:
table is {{{1,2,3},{0,57,101}},{{38,-80,95},{-10,13,34}}} and the length is 2.
See that {{1,2,3},{0,57,101}} is treated as single unit here and {{38,-80,95},{-10,13,34}} is treated as single unit here.
table[0] is {{1,2,3},{0,57,101}} and the length is 2.
table[0][0] is {1,2,3} and the length is 3.
So the output is 223.
Please let me know in case of any help needed.
Thank you.
Could someone please solve it? its java - The average of each integer array is stored...
The following programaverage stores integer numbers in onlarray coled table and compute the average of innermost array The average of each integer or ay is stored in other array called some Answer the three below using this program public class averageMultidis public static void main(String[] args) { int(300 table - { { {1,2,3), (0,57,101) },{ (38,-80,95).(-10,13,34} } }; doublel sumir new double[4); int su- int index = 0; 10 System.out.println("Size":table length table[0) length. table[0][0].length); 12 13 10 for (int i;...
JAVA HELP: Directions Write a program that will create an array of random numbers and output the values. Then output the values in the array backwards. Here is my code, I am having a problem with the second method. import java.util.Scanner; import java.util.Random; public class ArrayBackwards { public static void main(String[] args) { genrate(); print(); } public static void generate() { Scanner scanner = new Scanner(System.in); System.out.println("Seed:"); int seed = scanner.nextInt(); System.out.println("Length"); int length = scanner.nextInt(); Random random...
I'm attempting to convert ch object array to double array public void calculateSalesPrice() { double salePrice[] = new double[ch.length]; int p = 0; for (int i = 0; i < ch.length; i += 3) { p = i + 1; for(int j = 0;j } } error message:items.java:16: error: cannot find symbol for(int j = 0;j ^ symbol: variable length location: class Object items.java:17: error: array required, but Object found salePrice[j] = (double full program import java.io.File; import java.util.Scanner; import...
Which of the following are valid array declarations? a. int[] array- new int[10]; b. double [array double[10]; c. charl charArray "Computer Science"; None of the above Analyze the following code: class Test public static void main(Stringl] args) System.out.println(xMethod(10); public static int xMethod(int n) System.out.println("int"); return n; public static long xMethod(long n) System.out.,println("long"); return n The program displays int followed by 10 The program displays long followed by 10. The program does not compile. None of the above. tions 3-4 are...
2. Write a counter controlled loop to solve the following problems. Each one will involve an array (MinMax.java) Read in 25 ints from the keyboard, and store them in an array. Then, find the maximum and minimum values in such an array, and display them on the screen. public class Array-Assignment { public static void main(String [] args) { int [] x = new int[3]; int [] y = {3, 5, 9, 2}; x[2] = y[3]; ...
JAVA: array return types May you please help me fix this coding. Sum is SUPPOSE to be 1253 import java.util.Scanner; public class Array { public static int sum(int[] arr) { int i; int total = 0; for ( i =0; i < arr.length; ++i) { total = total + arr[i]; } return total; } public static void main(String[] args) { int[] myArray = {45, 22, 18, 89, 82, 79, 15, 69, 100, 55, 48, 72, 16, 98, 57, 75, 44,...
Help with a question in Java: What is the output from the following program? public class Methods2 { public static void main(String[] args) { for (int i = 0; i < 3; i++) { for (int j = 0; j <= i; j++){ System.out.print(fun(i, j) + "\t"); } System.out.println(); } } static long fun(int n, int k) { long p = 1; while (k > 0){ p *= n; } return p; } }
The following code is a Java code for insertion sort. I would like this code to be modified by not allowing more than 10 numbers of integer elements (if the user enters 11 or a higher number, an error should appear) and also finding the range of the elements after sorting. /* * Java Program to Implement Insertion Sort */ import java.util.Scanner; /* Class InsertionSort */ public class InsertionSortTwo { /* Insertion Sort function */ public static void sort( int...
need help editing or rewriting java code, I have this program
running that creates random numbers and finds min, max, median ect.
from a group of numbers,array. I need to use a data class and a
constructor to run the code instead of how I have it written right
now. this is an example of what i'm being asked
for.
This is my code:
import java.util.Random;
import java.util.Scanner;
public class RandomArray {
// method to find the minimum number in...
the code needs to be modifed. require a output for the
code
Java Program to Implement Insertion Sort import java.util.Scanner; /Class InsertionSort * public class Insertion Sort { /Insertion Sort function */ public static void sort( int arr) int N- arr.length; int i, j, temp; for (i-1; i< N; i++) j-i temp arrli; while (j> 0 && temp < arrli-1) arrli]-arrli-1]; j-j-1; } arrlj] temp; /Main method * public static void main(String [] args) { Scanner scan new Scanner( System.in...