Integer numBenefits 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 numBenefits is read from input, representing the number of integers to be read next. Then, the remaining integers are read and stored into array benefitsArray. For each element in benefitsArray that is less than 170: • Output the element, followed by ": corrected to 70 plus the current value" and a newline. • Assign the element with the element's current value plus 70. Ex: If the input is: 3 225 125 65 then the output is: Raw benefits: 225 125 65 125: corrected to 70 plus the current value 65: corrected to 70 plus the current value Adjusted benefits: 225 195 135. 1 import java.util.Scanner; 4234 in 1890 3 public class ArrayResize { 5 6 7 10 11 TELEP RP 4557WNI 12 13 14 15 16 17 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int[] benefitsArray; int numBenefits; int i; numBenefits scnr.nextInt(); benefitsArray = new int [numBenefits]; for (i = 0; i < benefitsArray.length; ++i) { benefitsArray[i] = scnr.nextInt (); } 14 4567 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 m for (i = 0; i < benefitsArray.length; ++i) { benefitsArray[i] = scnr.nextInt (); } System.out.print("Raw benefits: "); for (i = 0; i < benefitsArray.length; ++i) { System.out.print (benefitsArray[i] + 11 } System.out.println(); /* Your code goes here */ System.out.print("Adjusted benefits: "); for (i = 0; i < benefitsArray.length; ++i) { System.out.print (benefitsArray[i] + } System.out.println(); Integer numBenefits is read from input, representing the number of integers to be read next. Then, the remaining integers are read and stored into array benefitsArray. For each element in benefitsArray that is less than 170: • Output the element, followed by ": corrected to 70 plus the current value" and a newline. • Assign the element with the element's current value plus 70. Ex: If the input is: 3 225 125 65 then the output is: Raw benefits: 225 125 65 125: corrected to 70 plus the current value 65: corrected to 70 plus the current value Adjusted benefits: 225 195 135. 1 import java.util.Scanner; 4234 in 1890 3 public class ArrayResize { 5 6 7 10 11 TELEP RP 4557WNI 12 13 14 15 16 17 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int[] benefitsArray; int numBenefits; int i; numBenefits scnr.nextInt(); benefitsArray = new int [numBenefits]; for (i = 0; i < benefitsArray.length; ++i) { benefitsArray[i] = scnr.nextInt (); } 14 4567 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 m for (i = 0; i < benefitsArray.length; ++i) { benefitsArray[i] = scnr.nextInt (); } System.out.print("Raw benefits: "); for (i = 0; i < benefitsArray.length; ++i) { System.out.print (benefitsArray[i] + 11 } System.out.println(); /* Your code goes here */ System.out.print("Adjusted benefits: "); for (i = 0; i < benefitsArray.length; ++i) { System.out.print (benefitsArray[i] + } System.out.println();
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner public class ArrayResize public static void mai... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Tucker Boats began business on September 1, 2019, as a retail sales outlet for Swellcraft water-ski and fishing boats. Tucker Boats is located on the outskirts of Las Vegas, Nevada, and the area...
-
Write a program as follows: Ask the user for an integer representing a number of integers to be sorted. Create an array of integers of the size provided by user. Initialize the array to zeros. Ask...
-
Additional Information about the company follows: a. Hubs require $29 in direct materials per unit, and Sprockets require $11 b. The direct labor wage rate is $12 per hour. c. Hubs require special...
-
What tensions may arise if a shareholder-centric model is imposed on a stakeholder-focused society?
-
Federal Semiconductors issued 11% bonds, dated January 1, with a face amount of $800 million on January 1, 2018. The bonds sold for $739,814,813 and mature on December 31, 2037 (20 years). For bonds...
-
Mucho Macho is the leading beer in Patagonia, with a 65% share of the market. Because of trade barriers, it faces essentially no import competition. Exports account for less than 2% of sales....
-
Which type of adjustment will (a) increase both assets and revenues, (b) increase revenues and decrease liabilities, (c) increase expenses and decrease assets, and (d) increase both expenses and...
-
The income statement of Kaleta Co. for the month of July shows net income of $1,500 based on Service Revenue $5,500; Salaries and Wages Expense $2,100; Supplies Expense $900, and Utilities Expense...
-
Money Market Versus Call Option Hedging. You expect that inflation in the United States will be 3%, versus 5% in the United Kingdom. The expected spot rate in one year is $1.8756. The spot rate of...
-
Macon Machines Company began operations on November 1, 2024. The main operating goal of the company is to sell high end robots. Customers may pay using cash or if appropriate, credit is extended to...
-
The region bounded by y = x- - 3x and y = 3 - x is revolved about the line y = 4. To the nearest thousandth, what is the volume of the resulting solid? 56.968 O 77.074 O 107.233 O 241.274
-
Angle Company started business on January 1. During the year, the company purchased merchandise with an invoice price of \(\$ 500,000\). Angle also paid \(\$ 20,000\) freight on the merchandise....
-
Samuel Company uses the perpetual inventory system. Samuel purchased merchandise with an invoice price of \(\$ 800\), terms \(\mathbf{2} / \mathbf{1 0}, \mathbf{n} / \mathbf{3 0}\). If Samuel returns...
-
In the post-Enron environment, and with the enactment of the SarbanesOxley legislation, many firms are proactively portraying themselves as being "ethical." Ethical behavior is, for example, part of...
-
Why should a management accountant consider becoming a CMA?
-
Carole Company purchased \(\$ 6,000\) of merchandise and paid \(\$ 300\) in transportation costs to deliver the merchandise. Carole then returned \(\$ 1,000\) of the merchandise before paying the...
-
9-65. Determine the location (x, y) of the centroid C of the area. 1.5 in. 1.5 in. 1.5 in. 1.5 in. -1.5 in.- Prob. 9-65
-
Write the binomial probability in words. Then, use a continuity correction to convert the binomial probability to a normal distribution probability. P(x 110)
-
If you could make the mechanical equivalent of a stack that held golf clubs instead of numbers, why would it (conceptually) be a bad golf bag?
-
Define a class to represent a bank account. Data members should include the depositors name, the account number (use a string), and the balance. Member functions should allow the following: Creating...
-
Write a function that takes a reference to a string object as an argument and that converts the string object to all uppercase.
-
How did his actions inspire others? What were the results? Every year, the hospital provided free turkeys to employees during the Thanksgiving holiday. Eventually, the tradition became an entitlement...
-
What was required to achieve what he did? Every year, the hospital provided free turkeys to employees during the Thanksgiving holiday. Eventually, the tradition became an entitlement and a...
-
What leadership theories might apply in this case? Angie was an exceptional catheterization laboratory technician who was respected by her teammates. When the director of the cath lab took another...
Study smarter with the SolutionInn App