Programming Scenario Question
Please provide a solution written in Perl, Python, or Java to the
below problem. Perl is
preferred but not required. Pseudocode may be used if necessary,
though try to be as
specific as possible.
Write a program called “adder”. When run, this program
should do the following:
5. Continually read input from stdin.
6. If the input looks like an integer, add it to a counter that
starts at 0.
7. If the input looks like anything else, print a message stating
that input must be
an integer.
8. When an empty input is read, print a message indicating the
total value of the
counter and exit.
Below is an example of how running the program might
look from a CLI:
$ perl adder.pl
$ 1
$ 2
$ 3
$ asdf
Input must be an integer
$ 4
Total is: 10
$