$30
Assignment 2
CSE205 -Assignment #2
Important: This is an individual assignment. Please do not collaborate.
No late assignment will be accepted.
Make sure that you write every line of your code. Using code written by someone else
will be considered a violation of the academic integrity and will result in a report to the
Dean's office.
It must be submitted to GradeScope. The link is available from CSE205 course web
site.
Minimal Submitted Files
You are required, but not limited, to turn in the following source file: Assignment2.java
Requirements to get full credits in Documentation
The assignment number, your name, StudentID, Lecture day/time, and a class
description need to be included at the top of each file/class.
A description of each method is also needed. Some additional comments inside of
methods (especially for a "main" method) to explain code that are hard to follow should
be written.
New Skills to be Applied
In addition to what has been covered in previous assignments, the use of the following
items, discussed in class, will probably be needed:
Documentation
Primitive Data Types
Basic I/O
Expressions
Conditional and Loop statements
Program Description
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 count of odd integers in the sequence is 0
The largest even integer in the sequence is 0
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, count how many odd integers (cannot be divided by
2, “num%2 != 0”), compute the largest even integer (can be divided by 2, "num%2 ==
0"), and compute the sum of positive integers. You should not use arrays for this
assignment. It is using a loop to read the input and doing the calculation.
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.
Download the following input files, and save them in the same directory as
Assignment2.java is located to test for test cases.
input1.txt
input2.txt
input3.txt
input4.txt
output1.txt
output2.txt
output3.txt
output4.txt
Error Handling
Your program should be robust enough to handle all test cases above.
--------------------------------------------
What to turn in:
-Submit your Assignment2.java file via Gradescope- Assignment2 from course web
site. Make sure that it is passing all test cases. Otherwise you will lose points for test
cases (8pts).
Grading Criteria:
____/ 5 Documentation (header with your name, your information, and program
description and comments within your code)
____/ 1 Indentation and spacing (easy to read)
____/ 6 Required functions and functionalities implemented
____/ 8 Produces correct results?
Total points: 20
Copyright © 2020,
Arizona State University
All rights reserved.
ASU disclaimerLinks to an external site.
Copying any content of this page will be a violation of the copy right.