please help with the TODO's in bold below!
* Java application: CS140_Arrays.java
*
* Need to be done!
*
* TODO#1: Change the name and date accordingly
* Created by , 11/25/2019
*/
public class CS140_Arrays_Done
{
//TODO#2: Define two private static constants: rows (set to 5) & cols (set to 3)
//array for the values
private static double[][] values = { { 9, 10, 8 },
{ 3.5, 10, 8.5 },
{ 10, 8.5, 9 },
{ 8.5, 10, 7.5},
{ 10, 7.5, 8 } };
public static void main(String[] args)
{
//arrays for rowAvgs and colAvgs
//rowAvgs: average all values for each row
//colAvgs: average all values for each column
double[] rowAvgs = new double[rows];
double[] colAvgs = new double[cols];
calculateRowAvgs(rowAvgs);
/* TODO#4: call method calculateColAvgs to have column average result */
} //end main method
//calculate the average of all values for each row
public static void calculateRowAvgs(double[] rowAvgs)
{
/* TODO#3: add the nested for loop to
* calculate the average of all values for each row and print out
* use the next method as an example */
} //end method calculateRowAvgs
//calculate the average of all values for each column
public static void calculateColAvgs(double[] colAvgs)
{
System.out.println();
for (int i=0; i/*Java application:CS140_Arrays.java
*
*Need to be done!
*
*TODO#1:Change the name and date accordingly
*Created by,11/25/2019
*/
public class CS140_Arrays_Done {
//TODO#2: Define two private static constants: rows (set to 5) & cols (set to 3)
//array for the values
private static double[][] values = {{9, 10, 8},
{3.5, 10, 8.5},
{10, 8.5, 9},
{8.5, 10, 7.5},
{10, 7.5, 8}};
public static void main(String[] args) {
//arrays for rowAvgs and colAvgs
//rowAvgs: average all values for each row
//colAvgs: average all values for each column
double[] rowAvgs = new double[values.length];
double[] colAvgs = new double[values[0].length];
calculateRowAvgs(rowAvgs);
calculateColAvgs(colAvgs);
System.out.print("Row averages are:");
for (int i = 0; i < rowAvgs.length; i++) {
System.out.print(" " + rowAvgs[i]);
}
System.out.println();
System.out.print("Column averages are:");
for (int i = 0; i < colAvgs.length; i++) {
System.out.print(" " + colAvgs[i]);
}
System.out.println();
} //end main method
//calculate the average of all values for each row
public static void calculateRowAvgs(double[] rowAvgs) {
/* TODO#3: add the nested for loop to
* calculate the average of all values for each row and print out
* use the next method as an example */
for (int i = 0; i < values.length; i++) {
rowAvgs[i] = 0;
for (int j = 0; j < values[i].length; j++) {
rowAvgs[i] += values[i][j];
}
rowAvgs[i] /= values[i].length;
}
} //end method calculateRowAvgs
//calculate the average of all values for each column
public static void calculateColAvgs(double[] colAvgs) {
for (int i = 0; i < values[0].length; i++) {
colAvgs[i] = 0;
for (int j = 0; j < values.length; j++) {
colAvgs[i] += values[j][i];
}
colAvgs[i] /= values.length;
}
}
}

please help with the TODO's in bold below! * Java application: CS140_Arrays.java * * Need to...
In Java Please Create A Program For The Following; Please Note: This program should be able accept changes to the values of constants ROWS and COLS when testing the codes. Switch2DRows Given a 2D array with ROWS rows and COLS columns of random numbers 0-9, re-order the rows such that the row with the highest row sum is switched with the first row. You can assume that 2D arrau represents a rectangular matrix (i.e. it is not ragged). Sample run:...
//please help
I can’t figure out how to print and can’t get the random numbers to
print. Please help, I have the prompt attached. Thanks
import java.util.*;
public
class
Test
{
/**
Main method */
public
static
void main(String[]
args)
{
double[][]
matrix
=
getMatrix();
//
Display the sum of each column
for
(int
col
= 0;
col
<
matrix[0].length;
col++)
{
System.out.println(
"Sum
" + col
+
" is
" +
sumColumn(matrix,
col));
}
}
/**
getMatrix initializes an...
Help pls! and kindly explain how you do this as well. Thaank you Write a program to test whether a square is a 3x3 magic square. A magic square is a grid with 3 rows and 3 columns, like the figure below. A magic square has the following properties: the grid contains only the numbers 1 through 9 the sum of each row, each column, and each diagonal all add up to the same number Notes: I have provided the...
Hi I need help with a java program that I need to create a Airline Reservation System I already finish it but it doesnt work can someone please help me I would be delighted it doesnt show the available seats when running the program and I need it to run until someone says no for booking a seat and if they want to cancel a seat it should ask the user to cancel a seat or continue booking also it...
create a new Java application called "Scorer" (without the quotation marks) that declares a two-dimensional array of doubles (call it scores) with three rows and three columns and that uses methods and loops as follows. Use a method containing a nested while loop to get the nine (3 x 3) doubles from the user at the command line. Use a method containing a nested for loop to compute the average of the doubles in each row. Use a method to...
Java 1. Write a getCount method in the IntArrayWorker class that returns the count of the number of times a passed integer value is found in the matrix. There is already a method to test this in IntArrayWorkerTester. Just uncomment the method testGetCount() and the call to it in the main method of IntArrayWorkerTester. 2. Write a getLargest method in the IntArrayWorker class that returns the largest value in the matrix. There is already a method to test this in...
Java
Here is the template
public class ShiftNumbers {
public static void main(String[] args) {
// TODO: Declare matrix shell size
// TODO: Create first row
// TODO: Generate remaining rows
// TODO: Display matrix
}
/**
* firstRow
*
* This will generate the first row of the matrix, given the size n. The
* elements of this row will be the values from 1 to n
*
* @param size int Desired size of the array
* @return...
Using java :
In this exercise, you need to implement a class that encapsulate
a Grid. A grid is a useful concept in creating board-game
applications. Later we will use this class to create a board game.
A grid is a two-dimensional matrix (see example below) with the
same number of rows and columns. You can create a grid of size 8,
for example, it’s an 8x8 grid. There are 64 cells in this grid. A
cell in the grid...
Hello I am having trouble with a connectFour java program. this issue is in my findLocalWinner method, it declares a winner for horizontal wins, but not for vertical. if anyone can see what im doing wrong. public class ConnectFour { /** Number of columns on the board. */ public static final int COLUMNS = 7; /** Number of rows on the board. */ public static final int ROWS = 6; /** Character for computer player's pieces */ public static final...
Java : Please help me correct my code: create a single class (Program11.java) with a main method and some auxiliary methods to input a 2-D array from a disk file, input some “transactions” to change the 2-D array and output the changed 2-D array to another file. Your main method will be minimal (see below). Most of the work will go on in your methods. In main, declare (but do not instantiate) 2-D array. Then call the three methods. The...