Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What this Assignment Is About: Review on Java I topics, such as primitive data types, basic I/O, conditional and logical expressions, etc. Review on Java

What this Assignment Is About:

Review on Java I topics, such as primitive data types, basic I/O, conditional and logical expressions, etc.
Review on Java loops.
Documentation Requirements to get full credits in Documentation

The assignment number, your name, StudentID, Lecture number(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. You can look at the Java programs in the text book to see how comments are added to programs.
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 input 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, the number of odd integers (i.e. "num%2 == 1"), the largest even integer, and sum of all positive integers (are greater than 0) in the sequence.

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

For this assignment, you're required to write Assignment2.java from scratch, no skeleton of code is provided. 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions