The assignment will be similar to an assignment used frequently in CS116 classes. You will be given an integer array of positive numbers. Your program should process the array and do the following for each entry: Determine if the number is odd or even. Add to a counter for each type, i.e. an even counter and an odd counter. Add the number to a sum for each type, i.e. a total of the odd numbers and a total of the even numbers. A value of -999 indicates the end of the array. Your program should end at that point.   The input will be the following variable in your program: L3Array DCD 22,9,333,47,72,128,111,44,-999 The actual number of array entries and their values will be different when your program is graded. The last number will still be -999.   The output of your program will be the counts and totals placed in the following variables: L3OddCt DCD 0 ; count of odd numbers L3OddTot DCD 0 ; total of odd numbers L3EvCt DCD 0 ; count of even numbers L3EvTot DCD 0 ; total of even numbers   Your program must use the variable names L3Array, L3OddCt, L3OddTot, L3EvCt, and L3EvTot. The expected results for the array contents shown above are: L3OddCt = 4 L3OddTot = 500 L3EvCt = 4 L3EvTot = 266   Your program will be tested with a different set of values in L3Array. The expected output will vary based on that input. Do not assume that the array will contain eight values.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question

The assignment will be similar to an assignment used frequently in CS116 classes.

You will be given an integer array of positive numbers. Your program should process the array and do the following for each entry:

  • Determine if the number is odd or even.
  • Add to a counter for each type, i.e. an even counter and an odd counter.
  • Add the number to a sum for each type, i.e. a total of the odd numbers and a total of the even numbers.
  • A value of -999 indicates the end of the array. Your program should end at that point.

 

The input will be the following variable in your program:

  • L3Array DCD 22,9,333,47,72,128,111,44,-999

The actual number of array entries and their values will be different when your program is graded. The last number will still be -999.

 

The output of your program will be the counts and totals placed in the following variables:

  • L3OddCt DCD 0 ; count of odd numbers
  • L3OddTot DCD 0 ; total of odd numbers
  • L3EvCt DCD 0 ; count of even numbers
  • L3EvTot DCD 0 ; total of even numbers

 

Your program must use the variable names L3Array, L3OddCt, L3OddTot, L3EvCt, and L3EvTot.

The expected results for the array contents shown above are:

  • L3OddCt = 4
  • L3OddTot = 500
  • L3EvCt = 4
  • L3EvTot = 266

 

Your program will be tested with a different set of values in L3Array. The expected output will vary based on that input. Do not assume that the array will contain eight values.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage