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
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 Step by Step Solution
There are 3 Steps involved in it
Heres the implementation of the Filter program in Java java public class Filter public static void m... View full answer
Get step-by-step solutions from verified subject matter experts
