Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Understand how arrays are passed to methods and what that means for the array. What is the output of the following code and specify a

Understand how arrays are passed to methods and what that means for the array. What is the output of the following code and specify a stack diagram to show the state of the memory at the end of the method. import java.util.*; public class Rocket { public static void main(String[] args) { String[] twos = {AB, BC, CD}; performAction(twos); System.out.println(Arrays.toString(twos)); } public static void performAction(int [] data) { for (int i =0; i < data.length; i++) { data[i] = data[i] + Z; } } } *************************************************************************************** Be able to walk through a 2-dimensional array and state the output from the array. int [][] add = new int [10][10] for (int i = 0; i < 10; i++) { for(int j = 0; j < 10; j++) { add[i][j] = (i + j); System.out.print(add[i][j] + ); } System.out.println(); } What is outputted from this code ********************************************************************************************** Be able to walk through a program that reads data from a file and outputs data to a file, stating what is in the file once the file is written. File inputFile = new File(inputFileName); Scanner in = new Scanner(inputFile); PrintWriter out = new PrintWriter(outputFileName); double highest = 0; while (in.hasNext()){ int grade = in.nextInt(); if (grade > highest) highest = grade; } out.printf("The highest grade is: %10.d%n", highest); What would be outputted if the input file consisted of the following ints 56 76 45 90 34 88? ************************************************************************ Write pseudocode to read data from a file and manipulate that data as we have done in class activities. Write a method to return a calculation from an array.Write a method that will return the largest number from the array passed to the method.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions