Question: Java The program has to be similar to this: import java.util.*; import java.io.*; public class HelloWorld{ public static void rcConvert(int[][] ar1, int[][] ar2, int r,

Java

The program has to be similar to this:

import java.util.*; import java.io.*; public class HelloWorld{ public static void rcConvert(int[][] ar1, int[][] ar2, int r, int c){ int i,j; for(i=0; i

public static void main(String []args){ int i, j; //for iterating thru the array File inF = new File("file1"); Scanner in = null; try{ in = new Scanner(inF); } catch (Exception e) {System.out.println("Error: " + e);} int r = in.nextInt(); int c = in.nextInt(); //read rows & columns int[][] arr1 = new int[r][c]; //declare the required 2D array int[][] arr2 = new int[c][r]; //declare another array for(i=0; i

What i mean is that it has to follow like the patter trying to use short coding instead of heavy code(lot of lines of code)

Java The program has to be similar to this: import java.util.*; import

1a) Create file, file1, with the following values: Java Program 10 1 2 3 5 -4 2 16 3 2 1b) Write a program in Java to do the following: Open "file1" and read the first integer into variable n which is supposed to indicate the dimension of the one-dimensional array whose values are given in the file after the first integer. -Create a one-dimensional array of size n. Populate the one-dimensional array created in the previous step by reading values from file1: 1 2 3 5 4 2 1 6 3 2 Write a function, neg, using a for loop to negate all the values such that the array appears as follows: Write a function, storelnFile, to store the modified array in file file2 Call functions neg and storelnFile from the main program to negate the array elements and store the modified array in file2. Use structures like functions, while, do while, switch, for, and if where needed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!