Answer:

The partially completed program is below.

My Three Sums

import  java.util.Scanner;

// User enters a value N
// Add up odd integers,  
// even  integers, and all integers 0 to N
//
class addUpIntegers
{
  public static void main (String[] args ) 
  {
    Scanner scan = new Scanner( System.in );
    int N, sumAll = 0, sumEven = 0, sumOdd = 0;

    System.out.print( "Enter limit value: " );
    N = scan.nextInt();

    int count = 0 ;
    while (  count <= N )    
    {
      (more statements  go here )

      count = count + 1 ;
    }

    System.out.print  ( "Sum of all : " + sumAll  );
    System.out.print  ( "\tSum of even: " + sumEven );
    System.out.println( "\tSum of odd : " + sumOdd  );
  }
}

The loop counts through the integers we are interested in, but it does not yet do anything with them. This is what we want to happen:

QUESTION 4:

How do you decide which sum (sumAll or sumEven) to add an integer to?