Anonymous user
Decision tables: Difference between revisions
→{{header|REXX}}: added visual comments and removed two other comments, showed an alternative requirement format. -- ~~~~
m (→{{header|REXX}}: added a screen scraping for the possible responses. -- ~~~~) |
(→{{header|REXX}}: added visual comments and removed two other comments, showed an alternative requirement format. -- ~~~~) |
||
Line 743:
<lang rexx>/*REXX pgm demonstrates a decision table and possible corrective actions*/
/*REXX pgm demonstrates a decision table and possible corrective actions*/
ask.=
ask.1='Does the printer not print?'
Line 754 ⟶ 752:
set=set-1 /*adjust SET (number of ? asked)*/
act.= /* Y = yes
act.1 = 'y n y' ; pos.1 = 'Check the power cable.'▼
act.2 = 'y . y' ; pos.2 = 'check the printer-computer cable.'▼
act.3 = '. . y' ; pos.3 = 'Ensure printer software is installed.'▼
act.4 = '. y .' ; pos.4 = 'Check/replace ink.'▼
act.5 = 'y . n' ; pos.5 = 'Check for paper jam.'▼
/* ┌───────◄ answer to 1st question. */
/* │┌──────◄ answer to 2nd question. */
/* ││┌─────◄ answer to 3rd question. */
/* │││ */
/* ↓↓↓ */
/* act.2 could be also be set to: ynyYNY (lower/upper/mixed case).*/
do i=1 for set /*get responses from the prompts.*/
call asker i /*display question, get response.*/
end /*i*/
say
possible=0 /*we'll be counting possible sols*/
do k=1
do j=1; d=
jm=j//set; if jm==0 then jm=set
if d==
if \datatype(d,'U') then iterate
if d\==ans.jm then iterate k
if j==set then leave
end /*j*/
say pos.k /*this could be a possible sol. */
possible=possible+1 /*count num of possible solutions*/
end /*k*/
|