Define the method printVals() that takes two integer parameters and outputs all integers starting with the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Define the method printVals() that takes two integer parameters and outputs all integers starting with the first and ending with the second parameter, each multiplied by 1000 and followed by a newline. The method does not return any value. Ex: If the input is 15, then the output is: 1000 2000 3000 4000 5000 Note: Assume the first integer parameter is less than the second. 5 static void printvals(int x, int y){ 6 7 8 9 10 11 12 13 14 쌀밥 15 16 17 18 19 20 21} Check int i; for (1-x; x<-y; ++i) { 1000 2000 3000 System.out.println(1*1000); } // For the given example above of inputs 1 and 5, my for Loop method does not stop when x<-y should // become false and continues to increment past that infinitely, JAVA Advice please public static void main(String[] args) { Scanner scnr new Scanner(System.in); int inputi; int input2; } input1 scnr.nextInt (); input2 scnr.nextInt(); - printVals(input1, input2);: Next level 2 printVals() is called with arguments input1 and input2. A loop iterates from input1 to input2 and outputs all integers starting with input1 and ending with input2, each multiplied by 1000 and followed by a newline. 4000 5000 Not all tests passed. 3 Ex: For input 1 5, input1 is 1 and input2 is 5. Each integer from 1 to 5 is multiplied by 1000 1*1000,2*1000, 3* 1000, 4*1000, and 5* 1000. Thus the output is A Define the method printVals() that takes two integer parameters and outputs all integers starting with the first and ending with the second parameter, each multiplied by 1000 and followed by a newline. The method does not return any value. Ex: If the input is 15, then the output is: 1000 2000 3000 4000 5000 Note: Assume the first integer parameter is less than the second. 5 static void printvals(int x, int y){ 6 7 8 9 10 11 12 13 14 쌀밥 15 16 17 18 19 20 21} Check int i; for (1-x; x<-y; ++i) { 1000 2000 3000 System.out.println(1*1000); } // For the given example above of inputs 1 and 5, my for Loop method does not stop when x<-y should // become false and continues to increment past that infinitely, JAVA Advice please public static void main(String[] args) { Scanner scnr new Scanner(System.in); int inputi; int input2; } input1 scnr.nextInt (); input2 scnr.nextInt(); - printVals(input1, input2);: Next level 2 printVals() is called with arguments input1 and input2. A loop iterates from input1 to input2 and outputs all integers starting with input1 and ending with input2, each multiplied by 1000 and followed by a newline. 4000 5000 Not all tests passed. 3 Ex: For input 1 5, input1 is 1 and input2 is 5. Each integer from 1 to 5 is multiplied by 1000 1*1000,2*1000, 3* 1000, 4*1000, and 5* 1000. Thus the output is A
Expert Answer:
Related Book For
Financial Reporting Financial Statement Analysis and Valuation a strategic perspective
ISBN: 978-1337614689
9th edition
Authors: James M. Wahlen, Stephen P. Baginski, Mark Bradshaw
Posted Date:
Students also viewed these programming questions
-
Cane Company manufactures two products called Alpha and Beta that sell for $165 and $130, respectively. Each product uses only one type of raw material that costs $8 per pound. The company has the...
-
On January 2, 2024, the Jackson Company purchased equipment to be used in its manufacturing process. The equipment has an estimated life of eight years and an estimated residual value of $45,250. The...
-
Who do we reach out to in a company to provide an employee with advice and support regarding career related matters?
-
Three brothers, Daniel, David and Derrick have been discussing their respective taxation affairs and how much they dislike paying tax. None of them are Scottish taxpayers. Daniel's income for tax...
-
One rechargeable battery of mass 15.0 g delivers to a CD player an average current of 18.0 mA at 1.60 V for 2.40 h before the battery needs to be recharged. The recharger maintains a potential...
-
Find the force exerted by the biceps muscle in holding a 1-L milk carton (weight 9.9 N) with the forearm parallel to the floor. Assume that the hand is 35.0 cm from the elbow and that the upper arm...
-
Using Table 3.2, discuss potential safety issues associated with the usage of hydrogen as a fuel for automobiles running on fuel cells in comparison with those associated with vehicles running on...
-
A Nielsen study indicates that 18 to 24 year old spend a mean of 135 minutes watching video on their smartphones per month. (Data extracted bit. ly/1hF3BP2.) Assume that the amount of time watching...
-
wwwwwwwwwww. Implement a static method, called listRange, that takes one input parameter called head of type IntNode that represents the head of a linked list. The method then finds and returns the...
-
You have been hired as a consultant by Molycorp, a rare earth mineral mining company headquartered in Colorado. Your job is to evaluate a huge financing decision the company faces as part of its...
-
Are you an adaptable or resilient person? What do you think are the qualities a person should have to be adaptable and resilient?
-
Nordstrom has experienced a long history of success. Its strategy and architecture appear to have worked well. However, the company was engaged in labor union disputes and faced several lawsuits over...
-
Question 4 (10 points) Suppose that you discount the future hyperbolically. Assume that both and 8 are strictly greater than zero but strictly smaller than one. At t = 0, you are given the choice...
-
A Rankine regenerative steam cycle employs two stages of steam extraction for feedwater heating. Boiler pressure and temperature are 1,200 psia and 1,050F, respectively. Saturated steam at condenser...
-
A person pushes on a stationary 125-N box with a force of 81 N at 30 below the horizontal, as shown in the figure. (Figure 1) The coefficient of static friction between the box and the horizontal...
-
Jane goes out for a run. She runs 10 miles West for 2 hours, then she stops suddenly and turns and runs North for 30 minutes while speeding up at a rate of 4.0x10-3 [m/s2]. She stops again, then runs...
-
2.5c0.4 be the Consider the following utility maximization problem. Let u(c) = utility function, and let the marginal cost of consumption be A = 0.5, that is, it costs 0.5c to have consumption level...
-
Interest Compounded Annually. When P dollars is invested at interest rate i, compounded annually, for t years, the investment grows to A dollars, where A = P(1 + i) t . Trevor's parents deposit $7800...
-
The acquisition cost of inventory remaining at the end of a period is measured using LIFO, FIFO, or average cost. a. Rank cost of goods sold, gross profit, and ending inventory from highest to lowest...
-
The ordering of the three sections of the statement of cash flows is backwards for start-up firms, but it is more appropriate for businesses once they are up and running. Explain.
-
Assume that a company needs to acquire a large special-purpose materials handling facility. Given that no outside vendor exists for this type of facility and that the company has available...
-
According to Figure 1.2, intraEuropean Union trade accounts for a huge proportion of EU trade. What factor or factors might account for this fact? Asiab exports: $19.9 billion to U.S. & Canada ($4.9)...
-
According to Figure 1.2, the EU is a major customer of exports from Africa and the Middle East. What types of products do you think these areas produce for export, and why do you think the EU is...
-
For case 2 in Exercise 1, which country would prefer an international terms of trade of 1.2 rather than an international price of 1.66? Explain. Data from in exercise 1 For each of the following...
Study smarter with the SolutionInn App