Integer numValues is read from input, representing the number of integers to be read next. Then,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Integer numValues is read from input, representing the number of integers to be read next. Then, the remaining integers are read and stored into array inventories List. For each element in inventories List that is greater than 2000: • Output the element, followed by " is corrected to 2000" and a newline. • Assign the element with 2000. Ex: If the input is: 3 1000 2475 2225 then the output is: Raw inventories: 1000 2475 2225 2475 is corrected to 2000 2225 is corrected to 2000 Adjusted inventories: 1000 2000 2000 HERSTELBAREN 1 import java.util.Scanner; 3 public class ArrayResize { 6 8 10 11 12 13 14 15 16 17 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int[] inventoriesList; int numValues; int i; numValues= scnr.nextInt (); inventoriesList = new int[numValues]; for (i = 0; i < inventoriesList.length; ++i) { inventoriesList[i] scnr.nextInt (); } = 3 278922 16 17 18 19 20 21 22 23 24 24 25 25 27 28 29 30 31 32 26 32} } } System.out.print("Raw inventories: "); for (i = 0; i< inventoriesList.length; ++i) { System.out.print(inventories List[i] + "); } System.out.println(); /* Your code goes here */ System.out.print("Adjusted inventories: "); for (i = 0; i < inventoriesList.length; ++i) { System.out.print (inventories List[i] + System.out.println(); } 4 Integer numValues is read from input, representing the number of integers to be read next. Then, the remaining integers are read and stored into array inventories List. For each element in inventories List that is greater than 2000: • Output the element, followed by " is corrected to 2000" and a newline. • Assign the element with 2000. Ex: If the input is: 3 1000 2475 2225 then the output is: Raw inventories: 1000 2475 2225 2475 is corrected to 2000 2225 is corrected to 2000 Adjusted inventories: 1000 2000 2000 HERSTELBAREN 1 import java.util.Scanner; 3 public class ArrayResize { 6 8 10 11 12 13 14 15 16 17 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int[] inventoriesList; int numValues; int i; numValues= scnr.nextInt (); inventoriesList = new int[numValues]; for (i = 0; i < inventoriesList.length; ++i) { inventoriesList[i] scnr.nextInt (); } = 3 278922 16 17 18 19 20 21 22 23 24 24 25 25 27 28 29 30 31 32 26 32} } } System.out.print("Raw inventories: "); for (i = 0; i< inventoriesList.length; ++i) { System.out.print(inventories List[i] + "); } System.out.println(); /* Your code goes here */ System.out.print("Adjusted inventories: "); for (i = 0; i < inventoriesList.length; ++i) { System.out.print (inventories List[i] + System.out.println(); } 4
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner public class ArrayResize public static void mainString args Scanner s... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
USCo, a U.S. corporation, receives $700,000 of foreign-source passive income on which foreign taxes of $70,000 are withheld. Its worldwide taxable income is $1,500,000, and its U.S. tax liability...
-
For the Dupit Corp. case study introduced in Section 11.4, the management science team was able to apply a variety of queueing models by making the following simplifying approximation. Except for the...
-
Displacement vector A(vector) points due east and has a magnitude of 2.00 km. Displacement vector B(vector) points due north and has a magnitude of 3.75 km. Displacement vector C(vector) points due...
-
Changes in Cycles indicate the impact of the following on the cash and operating cycles, respectively. Use the letter I to indicate an increase, the letter D for a decrease, and the letter N for no...
-
Selected financial data for Tim Hortons and Starbucks are presented below for a recent year. Instructions (a) For each company, calculate the following ratios: 1. Current ratio 2. Receivables...
-
Round the clock cooling of an apartment having a load of \(300 \mathrm{MJ} /\) day requires an air conditioning plant of capacity about: (a) 1 ton (b) 5 ton (c) 10 tons (d) 25 tons
-
1. Whats your reaction to these events? Do you think your reaction is influenced by the culture, values, and traditions of the country in which you find yourself? Explain. 2. Look at what Hofstedes...
-
List any four applications of KNN. Explain with Example
-
Suppose the prices of zero-coupon bonds paying $100 at maturity are: Price Time to maturity (years) $96.15 1 $90.70 2 $83.96 3 $76.29 4 Bond B1 B B3 B4 a. [1pt] What is the price of the 3-year coupon...
-
3. Sweet Company recently reported $17,350 of sales. $4,000 of operating costs other than depreciation, and $2.500 of depreciation. It had $4.000 of bonds outstanding that carry a 7%interest rate,...
-
In this module, you've read about different types of sources: scholarly, popular, and trade. For this discussion forum, your task is to choose two of those three types of sources and find one...
-
Summarise what you are going to present in the report and justify your plan for delivering the research project to BIJ. Ensure you also clearly reference a data analytics framework as part of your...
-
Eight years ago Zack& Co. had purchased an equipment fo: $1,200,000. This equipment was being depreciated on a straight line basis over a 12 year period to a 300,000 salvage value. The equipment has...
-
It is a debate that has been raging for weeks. The Pullman City Council voted last night on a motion to approve a controversial sale and improvement project. The vote, which was 4-3, was a close one....
-
Why did the artist address this subject or issue? For what audience and in what situation was it created? Is knowledge of the audience and/or social, historical, and/or cultural situation relevent to...
-
Darlene and Daryl Jenkins lived in their home for twenty-five years. It sat by a little creek in town, and was one of the rare homes that didn't seem like a city home. As the city's population grew,...
-
Velshi Printers has contracts to complete weekly supplements required by fortysix customers. For the year 2018, manufacturing overhead cost estimates total $600,000 for an annual production capacity...
-
Suppose you have the following definitions: class Frabjous { private: char fab[20]; public: Frabjous(const char * s = "C++") : fab(s) { } virtual void tell() { cout < < fab; } }; class Gloam {...
-
Enhance the String class declaration (that is, upgrade string1.h to string2.h) by doing the following: a. Overload the + operator to allow you to join two strings into one. b. Provide a stringlow()...
-
Write a program that uses the following functions: Fill_array() takes as arguments the name of an array of double values and an array size. It prompts the user to enter double values to be entered in...
-
For a sample of data where n = 8 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....
-
For a sample of data where n = 4 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....
-
Assume that one of the investments listed in your investment portfolio had a 22% return in the first year and -28% return in the second. Calculate the geometric rate of return per year.
Study smarter with the SolutionInn App