Integer numVals is read from input and integer array student Numbers is declared with size numVals....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Integer numVals is read from input and integer array student Numbers is declared with size numVals. Then, numVals integers are read from input and stored into student Numbers. Replace the middle element in studentNumbers with -1. Ex: If the input is: 4 39 30 44 13 then the output is: Updated student numbers: 39 30 -1 13 Note: The index of the middle element is found by dividing the array's length by 2. 1 import java.util.Scanner; 2 3 public class StudentLog { 34567890 10 11 12 13 14 15 16 17 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int numVals; int[] studentNumbers; int i; numVals = scnr.nextInt(); studentNumbers = new int[numVals]; for (i = 0; i < studentNumbers.length; ++i) { student Numbers[i] = scnr.nextInt (); } /* Your code goes here */ 4 Note: The index of the middle element is found by dividing the array's length by 2. 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 } } numVals scnr.nextInt(); studentNumbers = new int[numVals]; for (i = 0; i < studentNumbers.length; ++i) { studentNumbers[i] = scnr.nextInt (); } /* Your code goes here */ System.out.print("Updated student numbers: "); for (i = 0; i < studentNumbers.length; ++i) { System.out.print (student Numbers [i] + " "); } System.out.println(); Integer numVals is read from input and integer array student Numbers is declared with size numVals. Then, numVals integers are read from input and stored into student Numbers. Replace the middle element in studentNumbers with -1. Ex: If the input is: 4 39 30 44 13 then the output is: Updated student numbers: 39 30 -1 13 Note: The index of the middle element is found by dividing the array's length by 2. 1 import java.util.Scanner; 2 3 public class StudentLog { 34567890 10 11 12 13 14 15 16 17 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int numVals; int[] studentNumbers; int i; numVals = scnr.nextInt(); studentNumbers = new int[numVals]; for (i = 0; i < studentNumbers.length; ++i) { student Numbers[i] = scnr.nextInt (); } /* Your code goes here */ 4 Note: The index of the middle element is found by dividing the array's length by 2. 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 } } numVals scnr.nextInt(); studentNumbers = new int[numVals]; for (i = 0; i < studentNumbers.length; ++i) { studentNumbers[i] = scnr.nextInt (); } /* Your code goes here */ System.out.print("Updated student numbers: "); for (i = 0; i < studentNumbers.length; ++i) { System.out.print (student Numbers [i] + " "); } System.out.println();
Expert Answer:
Related Book For
Digital Systems Design Using Verilog
ISBN: 978-1285051079
1st edition
Authors: Charles Roth, Lizy K. John, Byeong Kil Lee
Posted Date:
Students also viewed these programming questions
-
How do customer perceptions of equitys brand values compare to its competitors?
-
Create a slide on your product. Since you are promoting the athletic wear line, focus on a single product. Think about features, benefits, potential price, and performance measures (for instance, how...
-
What is the time and space complexity of this code? int A[ n ]; for (i = n / 2; i
-
Assume your company shows the market values of equity and debt at the level of $175373 and $224626, respectively. The rate of return on assets is 33 percent and its volatility is 45 percent. The...
-
Calculating Cash Collections the Morning Jolt Coffee Company has projected the following quarterly sales amounts for the coming year: a. Accounts receivable at the beginning of the year are $340....
-
The following selected ratios are available for Pampered Pets Inc.: Instructions (a) Has the company's collection of its receivables improved or weakened over the last three years? (b) Is the company...
-
Define the following: (i) COP, (ii) unit of refrigeration, and (iii) air conditioning.
-
Frobisher Inc. (Frobisher) uses the lower of cost and NRV rule to value its inventory. Frobishers inventory on February 28, 2017 had a cost of $1,125,000 and a NRV of $1,035,000. Required: a. By how...
-
. How a flash memory can be Read, Erased, or Programmed? Explain the steps involved.
-
Play the following games in the Games Fair: Three Prize Roller Word Scramble Marble Draw Ten Spinner For each Games Fair game, answer the following questions: Create the probability distribution in a...
-
Over a particular period, an asset had an average return of 5.1 percent and a standard deviation of 8.4 percent. What range of returns would you expect to see 95 percent of the time for this asset?...
-
Consider how well jewelry sales can be forecast on the basis of disposable personal income or unemployment rate, as measures of overall purchasing power. The explanatory variables selected are based...
-
How the company should monitor the general environment for changes that might affect the revenue and profitability of all products. What are changes required.
-
Dallas Pierce wants to know what rate she is paying on her simple discount note. The maturity value was $ 9 , 9 7 6 with $ 9 3 . 7 0 interest for 6 5 days. What was her rate?
-
Evoid main() int a; int x_value; string polinom [4]; "2*x*x+5*x+10"; "4*x*x+19"; polinom[0] polinom[1] polinom[2] = "x*x+1"; Write a program in C++; The program will ask the equation number and x...
-
Throughout all projects, there are positive and negative risks. A part of the risk management plan is to have a mitigation strategy for each type of risk. Put together a risk register for the Lucky...
-
3. [15pts] What is priority inversion? In a priority-driven system where all tasks are preemptable and that only need the processor to run, will priority inversion occur? Among the four protocols,...
-
Answer the following two independent questions. a. MM Corporation is considering several proposed investments for the coming budget year. MM produces electrical apparatus for industrial complexes....
-
Write a behavioral Verilog code for a floating-point multiplier using the IEEE single precision floating-point format. Use an overloaded multiplication operator instead of using an add-shift...
-
The following SM chart is to be realized using the two-address microprogramming structure shown in Figure 5-29. (a) Convert the SM chart to the proper form by adding a minimum number of states to the...
-
The following SM chart is to be realized using single-address microprogramming. (a) Show the new SM chart and show the state assignments. The MUX inputs are 1, X 1 , X 2 , and X 3 . Do not invert...
-
Classic LEGO plastic bricks have been fixtures in homes around the world for more than 70 years. Just 15 years ago, The LEGO Group (TLG) was near bankruptcy, spiraling downward and losing money at a...
-
For a sample of data where n = 6 given below: a. Calculate the mean, median, and mode. b. Calculate the range, variance, standard deviation, and coefficient of variation. c. Calculate the Z scores....
-
For a sample of data where n = 7 given below: a. Calculate the mean, median, and mode. b. Calculate the range, variance, standard deviation, and coefficient of variation. c. Calculate the Z score....
Study smarter with the SolutionInn App