Hi!
My problem is to write program answering if user's weight is correct or not.
The program must use the Potton's formula, that is:

NORMAL WEIGHT = HEIGHT - 100 - (HEIGHT - 100) /a

where:

NORMAL WEIGHT [kg]
HEIGHT [cm]
a = 10 for women
a = 20 for men

I think, I have to take 3 input's from user:

YOUR-WEIGHT - ?
YOUR-HEIGHT - ?
ARE YOU WOMEN OR MEN - ?

I am the very NEWBIE in JESS (week using only), but I tried to start
like that:

(deffunction pottons-formula
(?height ?a)
(-(- ?height 100)(/ ?a(- ?height 100))))

(defrule normal-weight
(dimensions ?height ?a)
=>
(printout t "Normal : " (pottons-formula ?height ?a crlf)))

(assert (dimensions 180 10))
(run)

...but the result is incorrect (program returns: 59.666..., and should
return: 72.0).
I don't get where is my mistake (in formula??)?
Can anybody tell me am I thinking correct?
And how to take inputs (using <read> command) from user (?YOUR-WEIGHT
?YOUR-HEIGHT
?ARE YOU WOMEN OR MEN)?

Best regards!

mailto: [EMAIL PROTECTED]

Reply via email to