Given the integer array dailyPrices with the size of NUM_INPUTS, write a for loop that sums each integer of dailyPrices together until either maxSum is greater than or equal to 250 or the end of the array is reached. Ex: If the input is 9 6 1 18 13 4 2 11 20, then the output is: Maximum sum: 84 2 3 public class ThresholdTracker { 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19} public static void main(String[] args) { Scanner scnr = new Scanner (System.in); final int NUM_INPUTS = 9; int[] dailyPrices = new int [NUM_INPUTS]; int i; int maxSum; } for (i = 0; i< dailyPrices.length; ++i) { dailyPrices [i] = scnr. nextInt(); } ******ADD NEW JAVA CODE HERE ****/ System.out.println("Maximum sum: + maxSum); 1 2 3

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 22PE
icon
Related questions
Question

Gery lines of code can NOT be edited.

New Java code must go inbetween the code. 

Given the integer array dailyPrices with the size of NUM_INPUTS, write a for loop that sums each integer of dailyPrices together
until either maxsum is greater than or equal to 250 or the end of the array is reached.
Ex: If the input is 9 6 1 18 13 4 2 11 20, then the output is:
Maximum sum: 84
2
3 public class ThresholdTracker {
4
6
7
8
9
10
11
public static void main(String[] args) {
Scanner scnr = new Scanner (System.in);
final int NUM_INPUTS = 9;
int[] dailyPrices = new int [NUM_INPUTS];
int i;
int maxSum;
for (i = 0; i < dailyPrices.length; ++i) {
dailyPrices [i] = scnr.nextInt ();
}
14
15 /*********ADD NEW JAVA CODE HERE****
16
17
18
19}
12
13
}
*********/
"
System.out.println("Maximum sum: + maxSum);
1
2
3
Transcribed Image Text:Given the integer array dailyPrices with the size of NUM_INPUTS, write a for loop that sums each integer of dailyPrices together until either maxsum is greater than or equal to 250 or the end of the array is reached. Ex: If the input is 9 6 1 18 13 4 2 11 20, then the output is: Maximum sum: 84 2 3 public class ThresholdTracker { 4 6 7 8 9 10 11 public static void main(String[] args) { Scanner scnr = new Scanner (System.in); final int NUM_INPUTS = 9; int[] dailyPrices = new int [NUM_INPUTS]; int i; int maxSum; for (i = 0; i < dailyPrices.length; ++i) { dailyPrices [i] = scnr.nextInt (); } 14 15 /*********ADD NEW JAVA CODE HERE**** 16 17 18 19} 12 13 } *********/ " System.out.println("Maximum sum: + maxSum); 1 2 3
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning