Current Page:
NeXtMidas Training
Getting Started - Part 2
Lab 3
Solution
|
|
- Lab 3 (Solution):
- You should have done this:
- The NeXtMidas shell comes with a few tables pre-defined (
AUX ,
OPT , REG , RAM , and ENV ).
What is the value of USER in the ENV table?
nM> get env.user
7S: ENV.USER = student
- The registry table (
REG ) has a table of handlers. The table of
handlers has multiple tables in it, one of which is called FILE .
In that FILE table, what is the value of JPEG ?
nM> get reg.handlers.file.jpeg
21S: REG.HANDLERS.FILE.JPEG = nxm.sys.lib.ImageFile
- Set a result named
FILE_TYPE to PRM .
nM> set FILE_TYPE PRM
- Use
SAY to print out the value in the FILE table
that corresponds with FILE_TYPE .
nM> say "^{reg.handlers.file.^{FILE_TYPE}}"
nxm.sys.lib.DataFile
- Create an empty table called
PEOPLE . Add two sub tables to it,
the first named JOHN set to {AGE=32,HEIGHT={FEET=5,INCHES=9}}
and the second named LINDA set to
{AGE=30,HEIGHT={FEET=5,INCHES=2}} .
nM> set people {}
nM> set people.john {AGE=32,HEIGHT={FEET=5,INCHES=9}}
nM> set people.linda {AGE=30,HEIGHT={FEET=5,INCHES=2}}
- Use
CALCULATOR to compute John's total height in inches. Store that
value in a result named HEIGHT .
nM> calc height people.john.height.feet 12 * people.john.height.inches +
Calc: HEIGHT = 69.0
- Compute John's total height again in inches, but this time store it back into the
people table under John's entry and call it
HEIGHT replacing the
previous height in a table with a total height in inches. Then do the same for
Linda.
nM> calc people.john.height people.john.height.feet 12 * &
people.john.height.inches +
Calc: PEOPLE.JOHN.HEIGHT = 69.0
nM> calc people.linda.height people.linda.height.feet 12 * &
people.linda.height.inches +
Calc: PEOPLE.LINDA.HEIGHT = 62.0
- Use
INFO to print out John's and Linda's heights in inches. When it
prints it should look like "John is 69.0in tall ".
nM> info "John is ^{people.john.height}in tall"
INFO: John is 69.0in tall
nM> info "Linda is ^{people.linda.height}in tall"
INFO: Linda is 62.0in tall
|
|
|