(Solved):Write a program that takes a series of int values as command line arguments. a total from the values, but add the values that are even, and subtract the values that are odd. Note that you’re basi… View Answer…

 

Question

Write a program that takes a series of int values as command line arguments.

a total from the values, but add the values that are even, and subtract the values that are odd.

Note that you’re basing the add/subtract operation on the value, not on the position in the argument list.

For example, if you call your class CmdLineProc,

java CmdLineProc 1 2 4 3 5 7 6 8 4 3

should calculate -1+2+4-3-5-7+6+8+4-3

 

EXPERT ANSWER

A

Scroll to top