Question: Integer arrays origArr and cleaning Arr are read from input, each containing three elements. If an element in cleaningArr is equal to 1, replace

Integer arrays origArr and cleaning Arr are read from input, each containing

  three elements. If an element in cleaningArr is equal to 1, replace

Integer arrays origArr and cleaning Arr are read from input, each containing three elements. If an element in cleaningArr is equal to 1, replace the corresponding element in origArr with -1. Otherwise, multiply the corresponding element in origArr by 2. Ex: If the input is: 44 17 46 43 1 35 then the output is: 88 -1 92 3 public class ResetNumbers { 4 public static void main(String[] args) { min 1000HN MAS 5 6 8 9 10 ALL111111 11 12 13 14 15 16 6789 17 18. 19 Scanner scnr = new Scanner(System.in); final int NUM_VALS = 3; int[] origArr = new int [NUM_VALS]; int[] cleaningArr = new int [NUM_VALS]; int i; for (i 0; i < NUM_VALS; ++i) { origArr[i] scnr.nextInt (); = } for (i = 0; i < NUM_VALS; ++i) { cleaningArr[i] scnr.nextInt (); = } /* Your code goes here */ 12 13 14 PPPPP 15 min 10 000 16 17 18 19 20 21 UNNNN. 22 23 24 25 } 26} origArr[i] = scnr.nextInt (); } for (i = 0; i < NUM_VALS; ++i) { cleaningArr[i] scnr.nextInt (); } * Your code goes here */ for (i = 0; i < origArr.length; ++i) { System.out.print (origArr[i] + " "); } System.out.println(); 1 = 2 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javautilScanner public class ResetNumbers public static void main... View full answer

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 Programming Questions!