write a program in Filter.java will filter an array of integers based on a given command option.
Fantastic news! We've Found the answer you've been seeking!
Question:
write a program in Filter.java will filter an array of integers based on a given command option.
Your program will have to support 2 command options and have the described behavior:
- even - prints out a list of all the even integers provided as argument
- odd - prints out a list of all odd integers provided as argument
Filter will always have either even or odd as the first argument and have either none or some integers as command line arguments.
If there are zero integers provided as command line arguments, print nothing (not even a new line)
$ javac Filter.java $ java Filter even -1 0 1 2 3 4 5 0 2 4 $ java Filter odd -1 0 1 2 3 4 5 -1 1 3 5 $ java Filter odd $ java Filter even $ java Filter even -2 -4 -6 -8 -2 -4 -6 -8
Related Book For
Statistics For Managers Using Microsoft Excel
ISBN: 9780133130805
7th Edition
Authors: David M. Levine, David F. Stephan, Kathryn A. Szabat
Posted Date: