# CSE205 Assignment #2 Solution

Assignment #2 will be the construction of a program that reads in an unspecified number of integers from standard input, performs some calculations on the inputted numbers, and outputs the results of those calculations to standard output. The numbers could be delimited by any kind of whitespace, i.e. tabs, spaces, and lines (Note that if you use the Scanner class, you do not have to worry about these delimiters. They will be taken care of). Your program will continue to read in numbers until the number 0 is entered. At this point, the calculations will be outputted in the following format:

The minimum integer is 0

The largest integer that is divisible by 2 is 0

The count of even integers in the sequence is 1

The sum of positive integers is 0

This means that using all numbers your program reads (including the last number 0), you need to compute the minimum, compute the largest integer that is divisible by 2, count how many even integers are in the sequence (can be divided by 2, "num%2 == 0"), and compute the sum of positive integers (are greater than 0).

Note that the above is an output for the first test case. For other test cases, you will have different numbers.

Do not prompt to query for the numbers. The number 0 is included in the sequence of integers and should be included in all of your calculations.

Input

The following files are the test cases that will be used as input for your program (Right-click and use "Save As"):

Test Case #1

Test Case #2

Test Case #3

Test Case #4

Output

The following files are the expected outputs of the corresponding input files from the previous section (Right-click and use "Save As"):

Test Case #1

Test Case #2

Test Case #3

Test Case #4

Error Handling

Your program should be robust enough to handle all test cases above.

The minimum integer is 0

The largest integer that is divisible by 2 is 0

The count of even integers in the sequence is 1

The sum of positive integers is 0

This means that using all numbers your program reads (including the last number 0), you need to compute the minimum, compute the largest integer that is divisible by 2, count how many even integers are in the sequence (can be divided by 2, "num%2 == 0"), and compute the sum of positive integers (are greater than 0).

Note that the above is an output for the first test case. For other test cases, you will have different numbers.

Do not prompt to query for the numbers. The number 0 is included in the sequence of integers and should be included in all of your calculations.

Input

The following files are the test cases that will be used as input for your program (Right-click and use "Save As"):

Test Case #1

Test Case #2

Test Case #3

Test Case #4

Output

The following files are the expected outputs of the corresponding input files from the previous section (Right-click and use "Save As"):

Test Case #1

Test Case #2

Test Case #3

Test Case #4

Error Handling

Your program should be robust enough to handle all test cases above.

You'll get 1 file (2.5KB)