Assignment2.java - check if its lower than the previously recorded min number if(number < minNumber minNumber = number if number is 0 then exit the loop

Assignment2.java - check if its lower than the previously...

This preview shows page 1 out of 1 page.

import java.util.Scanner; // Assignment #: 2 // Name: Arun Das (Teaching Assistant) // StudentID: XXXXXXXXXX // Lecture: T TH 12:00-1:15 PM // Description: This class reads an input sequence (from the command prompt) and // reports on the min number, the sum of even integers, and the // count of the positive integers in the input sequence public class Assignment2 { public static void main(String args[]) { int number = -1; Scanner console = new Scanner(System.in); int minNumber = Integer.MAX_VALUE; int sumOfEvenIntegers = 0; int posIntCount = 0; while (number != 0) { // read the number next in input number = console.nextInt();
Image of page 1

You've reached the end of your free preview.

Want to read the whole page?

  • Summer '19
  • Addition, Natural number, Arun Das

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture