This exercise includes a starter.java file. Use the starter file to write your program but make...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
This exercise includes a starter.java file. Use the starter file to write your program but make sure you do make changes ONLY in the area of the starter file where it is allowed, between the following comments: //#######your code starts here. //#######your code ends here if you modify the starter file anywhere else the Test will fail. Write a class called Increment Each Element containing a main method. Use the starter provided to create a reference to firstArray called reference and a copy of firstArray called copy. The starter declares the names firstArray, reference, and copy. just need to assign the appropriate array to each name. Then the starter calls the method incr which increments each element of each array by 1. Then the three arrays are printed. You cannot use the method Arrays.copyOf. examples % java IncrementEachElement 1 2 3 4 5 firstArray: [2, 3, 4, 5, 6] secondArray: [2, 3, 4, 5, 6] % java IncrementEach Element 0 firstArray: [1] secondArray: [1] % java IncrementEach Element 3579 firstArray: [4, 6, 8, 10] secondArray: [4, 6, 8, 10] //my version import java.util.*; public class IncrementEachElement { } public static int [] readArray(){ String ss = input.nextLine(); String [] aa = ss.split("[, ]"); int[] int_array = new int [aa. length]; if (aa [0]. length() == 0){ } //System.out.println("" + Arrays.toString(int_array)); int_array = new int [0]; return int_array; } // int ii = 0; for (String str: aa) { } int_array[ii++] = Integer.parseInt(str); } public static void incr(int [] aa) { } return int_array; for (int x = 0; x < aa.length; x++){ aa[x] = aa[x] + 1; } static Scanner input = new Scanner(System.in); public static void main (String[] args) { int [] firstArray; int [] reference; int[] copy; firstArray = readArray(); //#######your code starts here. //create a reference (or alias) to firstArray called "reference" //create a copy of firstArray called "copy" //#######your code ends here //the method incr adds 1 to each element of the array incr(firstArray); incr(reference); incr(copy); System.out.println("firstArray: " + Arrays.toString(firstArray)); System.out.println("reference: + Arrays.toString(reference)); System.out.println("copy: " + Arrays.toString(copy)); This exercise includes a starter.java file. Use the starter file to write your program but make sure you do make changes ONLY in the area of the starter file where it is allowed, between the following comments: //#######your code starts here. //#######your code ends here if you modify the starter file anywhere else the Test will fail. Write a class called Increment Each Element containing a main method. Use the starter provided to create a reference to firstArray called reference and a copy of firstArray called copy. The starter declares the names firstArray, reference, and copy. just need to assign the appropriate array to each name. Then the starter calls the method incr which increments each element of each array by 1. Then the three arrays are printed. You cannot use the method Arrays.copyOf. examples % java IncrementEachElement 1 2 3 4 5 firstArray: [2, 3, 4, 5, 6] secondArray: [2, 3, 4, 5, 6] % java IncrementEach Element 0 firstArray: [1] secondArray: [1] % java IncrementEach Element 3579 firstArray: [4, 6, 8, 10] secondArray: [4, 6, 8, 10] This exercise includes a starter.java file. Use the starter file to write your program but make sure you do make changes ONLY in the area of the starter file where it is allowed, between the following comments: //#######your code starts here. //#######your code ends here if you modify the starter file anywhere else the Test will fail. Write a class called Increment Each Element containing a main method. Use the starter provided to create a reference to firstArray called reference and a copy of firstArray called copy. The starter declares the names firstArray, reference, and copy. just need to assign the appropriate array to each name. Then the starter calls the method incr which increments each element of each array by 1. Then the three arrays are printed. You cannot use the method Arrays.copyOf. examples % java IncrementEachElement 1 2 3 4 5 firstArray: [2, 3, 4, 5, 6] secondArray: [2, 3, 4, 5, 6] % java IncrementEach Element 0 firstArray: [1] secondArray: [1] % java IncrementEach Element 3579 firstArray: [4, 6, 8, 10] secondArray: [4, 6, 8, 10] This exercise includes a starter.java file. Use the starter file to write your program but make sure you do make changes ONLY in the area of the starter file where it is allowed, between the following comments: //#######your code starts here. //#######your code ends here if you modify the starter file anywhere else the Test will fail. Write a class called Increment Each Element containing a main method. Use the starter provided to create a reference to firstArray called reference and a copy of firstArray called copy. The starter declares the names firstArray, reference, and copy. just need to assign the appropriate array to each name. Then the starter calls the method incr which increments each element of each array by 1. Then the three arrays are printed. You cannot use the method Arrays.copyOf. examples % java IncrementEachElement 1 2 3 4 5 firstArray: [2, 3, 4, 5, 6] secondArray: [2, 3, 4, 5, 6] % java IncrementEach Element 0 firstArray: [1] secondArray: [1] % java IncrementEach Element 3579 firstArray: [4, 6, 8, 10] secondArray: [4, 6, 8, 10] This exercise includes a starter.java file. Use the starter file to write your program but make sure you do make changes ONLY in the area of the starter file where it is allowed, between the following comments: //#######your code starts here. //#######your code ends here if you modify the starter file anywhere else the Test will fail. Write a class called Increment Each Element containing a main method. Use the starter provided to create a reference to firstArray called reference and a copy of firstArray called copy. The starter declares the names firstArray, reference, and copy. just need to assign the appropriate array to each name. Then the starter calls the method incr which increments each element of each array by 1. Then the three arrays are printed. You cannot use the method Arrays.copyOf. examples % java IncrementEachElement 1 2 3 4 5 firstArray: [2, 3, 4, 5, 6] secondArray: [2, 3, 4, 5, 6] % java IncrementEach Element 0 firstArray: [1] secondArray: [1] % java IncrementEach Element 3579 firstArray: [4, 6, 8, 10] secondArray: [4, 6, 8, 10] This exercise includes a starter.java file. Use the starter file to write your program but make sure you do make changes ONLY in the area of the starter file where it is allowed, between the following comments: //#######your code starts here. //#######your code ends here if you modify the starter file anywhere else the Test will fail. Write a class called Increment Each Element containing a main method. Use the starter provided to create a reference to firstArray called reference and a copy of firstArray called copy. The starter declares the names firstArray, reference, and copy. just need to assign the appropriate array to each name. Then the starter calls the method incr which increments each element of each array by 1. Then the three arrays are printed. You cannot use the method Arrays.copyOf. examples % java IncrementEachElement 1 2 3 4 5 firstArray: [2, 3, 4, 5, 6] secondArray: [2, 3, 4, 5, 6] % java IncrementEach Element 0 firstArray: [1] secondArray: [1] % java IncrementEach Element 3579 firstArray: [4, 6, 8, 10] secondArray: [4, 6, 8, 10] This exercise includes a starter.java file. Use the starter file to write your program but make sure you do make changes ONLY in the area of the starter file where it is allowed, between the following comments: //#######your code starts here. //#######your code ends here if you modify the starter file anywhere else the Test will fail. Write a class called Increment Each Element containing a main method. Use the starter provided to create a reference to firstArray called reference and a copy of firstArray called copy. The starter declares the names firstArray, reference, and copy. just need to assign the appropriate array to each name. Then the starter calls the method incr which increments each element of each array by 1. Then the three arrays are printed. You cannot use the method Arrays.copyOf. examples % java IncrementEachElement 1 2 3 4 5 firstArray: [2, 3, 4, 5, 6] secondArray: [2, 3, 4, 5, 6] % java IncrementEach Element 0 firstArray: [1] secondArray: [1] % java IncrementEach Element 3579 firstArray: [4, 6, 8, 10] secondArray: [4, 6, 8, 10] //my version import java.util.*; public class IncrementEachElement { } public static int [] readArray(){ String ss = input.nextLine(); String [] aa = ss.split("[, ]"); int[] int_array = new int [aa. length]; if (aa [0]. length() == 0){ } //System.out.println("" + Arrays.toString(int_array)); int_array = new int [0]; return int_array; } // int ii = 0; for (String str: aa) { } int_array[ii++] = Integer.parseInt(str); } public static void incr(int [] aa) { } return int_array; for (int x = 0; x < aa.length; x++){ aa[x] = aa[x] + 1; } static Scanner input = new Scanner(System.in); public static void main (String[] args) { int [] firstArray; int [] reference; int[] copy; firstArray = readArray(); //#######your code starts here. //create a reference (or alias) to firstArray called "reference" //create a copy of firstArray called "copy" //#######your code ends here //the method incr adds 1 to each element of the array incr(firstArray); incr(reference); incr(copy); System.out.println("firstArray: " + Arrays.toString(firstArray)); System.out.println("reference: + Arrays.toString(reference)); System.out.println("copy: " + Arrays.toString(copy)); //my version import java.util.*; public class IncrementEachElement { } public static int [] readArray(){ String ss = input.nextLine(); String [] aa = ss.split("[, ]"); int[] int_array = new int [aa. length]; if (aa [0]. length() == 0){ } //System.out.println("" + Arrays.toString(int_array)); int_array = new int [0]; return int_array; } // int ii = 0; for (String str: aa) { } int_array[ii++] = Integer.parseInt(str); } public static void incr(int [] aa) { } return int_array; for (int x = 0; x < aa.length; x++){ aa[x] = aa[x] + 1; } static Scanner input = new Scanner(System.in); public static void main (String[] args) { int [] firstArray; int [] reference; int[] copy; firstArray = readArray(); //#######your code starts here. //create a reference (or alias) to firstArray called "reference" //create a copy of firstArray called "copy" //#######your code ends here //the method incr adds 1 to each element of the array incr(firstArray); incr(reference); incr(copy); System.out.println("firstArray: " + Arrays.toString(firstArray)); System.out.println("reference: + Arrays.toString(reference)); System.out.println("copy: " + Arrays.toString(copy)); //my version import java.util.*; public class IncrementEachElement { } public static int [] readArray(){ String ss = input.nextLine(); String [] aa = ss.split("[, ]"); int[] int_array = new int [aa. length]; if (aa [0]. length() == 0){ } //System.out.println("" + Arrays.toString(int_array)); int_array = new int [0]; return int_array; } // int ii = 0; for (String str: aa) { } int_array[ii++] = Integer.parseInt(str); } public static void incr(int [] aa) { } return int_array; for (int x = 0; x < aa.length; x++){ aa[x] = aa[x] + 1; } static Scanner input = new Scanner(System.in); public static void main (String[] args) { int [] firstArray; int [] reference; int[] copy; firstArray = readArray(); //#######your code starts here. //create a reference (or alias) to firstArray called "reference" //create a copy of firstArray called "copy" //#######your code ends here //the method incr adds 1 to each element of the array incr(firstArray); incr(reference); incr(copy); System.out.println("firstArray: " + Arrays.toString(firstArray)); System.out.println("reference: + Arrays.toString(reference)); System.out.println("copy: " + Arrays.toString(copy)); //my version import java.util.*; public class IncrementEachElement { } public static int [] readArray(){ String ss = input.nextLine(); String [] aa = ss.split("[, ]"); int[] int_array = new int [aa. length]; if (aa [0]. length() == 0){ } //System.out.println("" + Arrays.toString(int_array)); int_array = new int [0]; return int_array; } // int ii = 0; for (String str: aa) { } int_array[ii++] = Integer.parseInt(str); } public static void incr(int [] aa) { } return int_array; for (int x = 0; x < aa.length; x++){ aa[x] = aa[x] + 1; } static Scanner input = new Scanner(System.in); public static void main (String[] args) { int [] firstArray; int [] reference; int[] copy; firstArray = readArray(); //#######your code starts here. //create a reference (or alias) to firstArray called "reference" //create a copy of firstArray called "copy" //#######your code ends here //the method incr adds 1 to each element of the array incr(firstArray); incr(reference); incr(copy); System.out.println("firstArray: " + Arrays.toString(firstArray)); System.out.println("reference: + Arrays.toString(reference)); System.out.println("copy: " + Arrays.toString(copy)); //my version import java.util.*; public class IncrementEachElement { } public static int [] readArray(){ String ss = input.nextLine(); String [] aa = ss.split("[, ]"); int[] int_array = new int [aa. length]; if (aa [0]. length() == 0){ } //System.out.println("" + Arrays.toString(int_array)); int_array = new int [0]; return int_array; } // int ii = 0; for (String str: aa) { } int_array[ii++] = Integer.parseInt(str); } public static void incr(int [] aa) { } return int_array; for (int x = 0; x < aa.length; x++){ aa[x] = aa[x] + 1; } static Scanner input = new Scanner(System.in); public static void main (String[] args) { int [] firstArray; int [] reference; int[] copy; firstArray = readArray(); //#######your code starts here. //create a reference (or alias) to firstArray called "reference" //create a copy of firstArray called "copy" //#######your code ends here //the method incr adds 1 to each element of the array incr(firstArray); incr(reference); incr(copy); System.out.println("firstArray: " + Arrays.toString(firstArray)); System.out.println("reference: + Arrays.toString(reference)); System.out.println("copy: " + Arrays.toString(copy)); //my version import java.util.*; public class IncrementEachElement { } public static int [] readArray(){ String ss = input.nextLine(); String [] aa = ss.split("[, ]"); int[] int_array = new int [aa. length]; if (aa [0]. length() == 0){ } //System.out.println("" + Arrays.toString(int_array)); int_array = new int [0]; return int_array; } // int ii = 0; for (String str: aa) { } int_array[ii++] = Integer.parseInt(str); } public static void incr(int [] aa) { } return int_array; for (int x = 0; x < aa.length; x++){ aa[x] = aa[x] + 1; } static Scanner input = new Scanner(System.in); public static void main (String[] args) { int [] firstArray; int [] reference; int[] copy; firstArray = readArray(); //#######your code starts here. //create a reference (or alias) to firstArray called "reference" //create a copy of firstArray called "copy" //#######your code ends here //the method incr adds 1 to each element of the array incr(firstArray); incr(reference); incr(copy); System.out.println("firstArray: " + Arrays.toString(firstArray)); System.out.println("reference: + Arrays.toString(reference)); System.out.println("copy: " + Arrays.toString(copy));
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
What is the "ALDI Way" and what was its quest? Take out costs; eliminate complexity Survival; make enough money to pay overhead costs Increase market share; find more prospective customers Build...
-
On June 30, 2016, the market interest rate is 8%. Team Sports Ltd. issues $800,000 of 10%, 10-year bonds payable. The bonds pay interest on June 30 and December 31. Team Sports Ltd. amortizes bond...
-
Green Captain Solar manufactures and sells solar panels that can be added on to existing solar panel systems on individual homes and businesses. The market covers both new panels as well as recycled...
-
What pleadings the defendant may file in response to the complaint?
-
Forestcrest Woolen Mills is a closely held North Carolina company that has existed since 1920. The company manufactures high- quality woolen cloth for mens and womens outerwear. Your firm has audited...
-
Myra Company is retail sporting goods store that uses accrual accounting for its records. Facts regarding Myra's operations are as follows: Sales are budgeted at P220, 000 for December 19x9 and...
-
Ramsey Liquors owns and operates a chain of beer and wine shops throughout the Dallas-Fort Worth metroplex. The rapidly expanding population of the area has resulted in the firm requiring a growing...
-
The amount of CPP contributions has been 4.95% of CPP pensionable earnings for many years. For 2014, the year's maximum pensionable earnings (YMPE) is $52,500 and the first $3,500 is the year's basic...
-
Give a synthesis discussion of the topic: Mathematics organize patterns and regularities in the world.
-
7. Consider a uniformly doped GaAs pn junction at T =300 K. The junction capacitance at zero bias is C'(0) and the junction capacitance with a 10V reverse-biased voltage is C'(10). The ratio of the...
-
The total cost (in dollars) of producing x food processors is C(x) = 1700 + 70x-0.3x (A) Find the exact cost of producing the 51st food processor. (B) Use the marginal cost to approximate the cost of...
-
How many real roots does the equation 25 +32 +5 = 0 have?
-
You are given the following data: vocabulary V = {w1, w2, w3) and the bigram probability distribution p on V x V given by: p(w1, w1) = p(w3, w3) = 1/5 p(w2, w2) = 0, p(w2, w1) = 1/6, p(w1, w3) = 1/5,...
-
A. Creating a pie chart in Tableau typicallyinvolves: 1. Only measures 2. Only measures and paramteres 3. Measures and dimension 4. Only dimensions 5. Parameters B. Consider the dimension From...
-
Anne is employed by Bradley Contracting Company. Bradley has a $1.3 million contract to build a small group of outbuildings in a national park. Anne alleges that Bradley Contracting has discriminated...
-
Ken paid the following amounts for interest during 2012: Qualified interest on home mortgage...........................................$4,700 Auto loan...
-
Yolanda earns $112,000 in 2012. Calculate the FICA tax that must be paid by: Yolanda:.....................Soc.Sec..................$__________...
-
For each of the following situations, indicate whether the taxpayer(s) is (are) required to file a tax return for 2012. Explain your answer. a. Helen is a single taxpayer with interest income in 2012...
-
Derive the frequency equation for the longitudinal vibration of the systems shown in Fig. 8.28. M p. A, E.1 p.A. E,I M k p. A. E,I ell M k (a) (b) FIGURE 8.28 Bar with different end conditions. (c)
-
Fill in the Blank. The ____________ energy of a beam is denoted by \(\frac{1}{2} \int_{0}^{l} E I\left(\frac{\partial^{2} w}{\partial x^{2}} ight)^{2} d x\).
-
A thin bar of length \(l\) and mass \(m\) is clamped at one end and free at the other. What mass \(M\) must be attached to the free end in order to decrease the fundamental frequency of longitudinal...
Study smarter with the SolutionInn App