|
|
The lecture
notes for Wed and Thu are from an older version of A202. (Two years ago A202
used to study some of the things that now properly belong in A201.) A201 and
A202 have evolved a lot in the last five years or so, and so have all of us,
and will continue to so forever, as you would probably expect us to. So Wednesday's
lecture notes will give you an introduction to terminal I/O, sections 2.8, 3.10 and
13.1-4 in your text. And Thursday's lecture notes will give you an intro to basic
networking with Java, which is a breeze (and the right thing to study) if you know
terminal I/O. In class we will discuss:
A201/A597 LAB ASSIGNMENT FOURTEEN
For this assignment you are to write an arithmetic expression evaluator that is able to perform additions and multiplications, store results in named locations (variables) and allow them in expressions as well, as illustrated in the sample session below:
You may safely assume that your only operands are integers and that the names of variables are comprised of only alphabetical characters. You do not need to do any exquisite error-checking (it is OK for your program to exit with an error message if the user makes a mistake as long as all correctly written expressions are evaluated correctly).frilled.cs.indiana.edu%javac Eval.java frilled.cs.indiana.edu%java Eval Arithmetic Evaluator 1.0 Copyright A201 Systems Ltd. Eval> 1 1 Eval> 1 + 2 3 Eval> 1 + 2 * 3 7 Eval> 1 * 2 + 3 5 Eval> a = 2 2 Eval> a 2 Eval> a = a + 3 5 Eval> a 5 Eval> b = 1 1 Eval> c = a + b 6 Eval> a 5 Eval> b 1 Eval> c 6 Eval> c = c * a + b 31 Eval> c 31 Eval> exit frilled.cs.indiana.edu%
Help is available, but please refer to it only after you have exhausted your very own resources.
Here's the help I can offer, to help you get started.