Question: Managed to get my code up and running (that is, turning out the correct outputs) but the math is off. I wanted to make it

Managed to get my code up and running (that is, turning out the correct outputs) but the math is off. I wanted to make it read various values in input files for test cases, and come back with the largest in the sequence, the largest even integer, the count of all positive integers, and the sum of all integers. I know I have to replace the operations in the else if statements, but I'm not positive with what to output the correct answers. Managed to get my code up and running (that is, turning out

1 5 7 24 import java.io.FileNotFoundException;) 6 public class Assignment2 { 8e public static void main(String[] args) { 9 10 int largest= 0; 11 int largestEven = 0; 12 int countOfAllPositive = 0; 13 int sumofAll = ; 14 15 try { 16 Scanner input1 = new Scanner(new File("input2.txt")); 17 while (input1.hasNextInt() { 18 int value = input1.nextInt(); 19 if (value ) 20 { break; 21 } else if (value 0) 24 { largestEven += value; 25 } else if (value % 2 == 0) 26 { countOfAllPositive += value; 27 } else if (value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!