## BMI AND BMR

Expand Messages
• Hi all group The BMR is, Basal Metabolic Rate .It is the minimum calorific requirement needed to sustain life in a resting individual. It can be looked at as
Message 1 of 8 , Jan 30, 2010
Hi all group
The BMR is, Basal Metabolic Rate .It is the minimum calorific requirement needed to sustain life in a resting individual. It can be looked at as being the amount of energy expended by the body to remain in bed asleep all day!
I have made the following code and fixed the variables temporally to facilitate calculations of BMI and BMR, calculation of BMI is ok.
But for the BMR is not, the result is 1875 for male and female with same other variables, while they should be "MALE BMR=1603" and "FEMALE BMR=1445"
Thank you
PS
I will carry on adding the necessary information till we get a modern and scientific code for healthy reducing or putting on weight method.

`The code
nomainwin
WindowWidth = 400
WindowHeight = 600
UpperLeftX =INT( (DisplayWidth- WindowWidth) /2)
UpperLeftY =INT( (DisplayHeight- WindowHeight) /2)

BackgroundColor\$ = "Green"
ForegroundColor\$ = "blue"
TextboxColor\$ = "yellow"

BUTTON #A.1 "Quit", [quit],UL, 300, 530, 70, 25
BUTTON #A.2 "Again", [getInp], UL, 25, 530, 70, 25
BUTTON #A.3, "info", [info], UL, 164, 530, 70, 25

BUTTON #A.4, " Calculate ",[enter],UL, 150,470
BUTTON #A.Default, "",[enter], UL, 0, 0, 0, 0

STATICTEXT #A "BMI AND BMR", 135,10, 250, 25

TEXTBOX #A.txtbox1, 265,250,60,30
TEXTBOX #A.txtbox2, 265,300,60,30
TEXTBOX #A.txtbox3, 265,350,60,30
TEXTBOX #A.txtbox4, 265,400,60,30
TEXTBOX #A.txtbox5, 10,250, 240, 30
TEXTBOX #A.txtbox6, 10,300, 240, 30
TEXTBOX #A.txtbox7, 10,350, 240, 30
TEXTBOX #A.txtbox8, 10,400, 240, 30

GRAPHICBOX #A.BMIresult, 30, 40, 330, 30
GRAPHICBOX #A.BMRresult, 30, 80, 330, 30

OPEN "BMI AND BMR" FOR DIALOG AS #A

#A "font Times_New_Roman 14"
#A.BMIresult "color red"
#A.BMRresult "color red"
#A.BMIresult "font times_new_roman 14"
#A.BMRresult "font times_new_roman 14"

#A.txtbox5 " Gender (M=Male,F=Femal)"
#A.txtbox6 " Age in (years)"
#A.txtbox7 " Height ( in Centimetre)"'xxxxxxxxx
#A.txtbox8 " Weight ( in kg)"'xxxxxxxxxxx

#A.BMIresult "fill cyan ; backcolor cyan"
#A.BMRresult "fill cyan ; backcolor cyan"
#A "trapclose [quit]"
[getInp]

'Clears input text if doing again
#A.txtbox1, "m"
#A.txtbox2, "40"
#A.txtbox3, "170"
#A.txtbox4, "70"
#A.BMIresult, ""'XXXXXXXX DOES NOT WORK ????
#A.BMIresult "fill cyan ; backcolor cyan"
#A.BMRresult "fill cyan ; backcolor cyan"

WAIT

[enter]
PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
PRINT #A.txtbox2, "!contents? y" 'Get Age in (year)
PRINT #A.txtbox3, "!contents? h" 'Get Height in (cm)
PRINT #A.txtbox4, "!contents? w" 'Get weight in (kg)

key\$ = Inkey\$
if g\$="f" then goto [female]
if g\$="m" then goto [male]

BMI =0.1 *int( 10 *w /((h/100)^2) )

[female]
BMR = 655 + ( 9.6 * w ) + ( 1.8 * h ) - ( 4.7 * a )

[male]
BMR = 66 + ( 13.7 * w ) + ( 5 * h ) - ( 6.8 * a )

#A.BMIresult "place 5 20"
#A.BMRresult "place 5 20"

select case
case BMI < 18.5
#A.BMIresult "\BMI= "; BMI; " --> under weight"

case BMI < 25
#A.BMIresult "\BMI= "; BMI; " --> normal weight"

case BMI < 30
#A.BMIresult "\BMI= "; BMI; " --> over weight"

case BMI < 35
#A.BMIresult "\BMI= "; BMI; " --> fatness"

case BMI < 40
#A.BMIresult "\BMI= "; BMI; " --> severe fatness"

case BMI >=40
#A.BMIresult "\BMI= "; BMI; " --> extreme fatness"
end select

select case
case g\$ ="f"

#A.BMRresult "\FEMALE BMR= "; BMR; " Calories/day"
case g\$ ="m"

#A.BMRresult "\MALE BMR= "; BMR; " Calories/day"
end select

wait

[info]
WindowWidth = 350
WindowHeight = 430

BackgroundColor\$ = "red"
ForegroundColor\$ = "white"
UpperLeftX = INT( (DisplayWidth- WindowWidth) /2)+370
UpperLeftY = INT( (DisplayHeight- WindowHeight) /2)+0

statictext #info.stext1, "BMI Calculator is to Calculate the BMI =Body Mass Index", 22, 16, 312, 20
statictext #info.stext2, "BMI=18.4 or less = under weight ", 22, 36,312, 20
statictext #info.stext3, "BMI=18.5-24. 9 = normal weight", 22, 56,312, 20
statictext #info.stext4, "BMI=25-29.9 = over weight", 22, 76,312, 20
statictext #info.stext5, "BMI=30-34.9 = fatness ", 22, 96, 312, 20
statictext #info.stext6, "BMI=35-39.9 = severe fatness", 22,116, 312, 20
statictext #info.stext7, "BMI=40 or more = extreme fatness ", 22,136, 312, 20
statictext #info.stext8, " ", 22,156, 312, 20
statictext #info.stext9, "The BMR Calculator will calculate Basal Metabolic Rate. It is ", 22, 176, 312, 20
statictext #info.stext10, "the number of calories needed to sustain life in a resting individual.", 22, 196,312, 20
statictext #info.stext11, "It could be the amount of energ expended by the body to remain", 22, 216,312, 20
statictext #info.stext11, "in bed asleep all day! ", 22, 236,312, 20

button #info.OK, "OK", [closeinfoBox] , UL, 255, 370, 64, 35

open "BMI AND BMR" for window_popup as #info
wait

[closeinfoBox]
close #info
wait
[quit]
CLOSE #A
END
`Code end
• Following to my previous message Sorry for all The line of BMI =0.1 *int( 10 *w /((h/100)^2) ) Should be before key\$ = Inkey\$ otherwise the following is the
Message 2 of 8 , Jan 30, 2010
Following to my previous message
Sorry for all
The line of
BMI =0.1 *int( 10 *w /((h/100)^2) )
Should be before
key\$ = Inkey\$
otherwise the following is the correct code and waiting for your help

nomainwin
WindowWidth = 400
WindowHeight = 600
UpperLeftX =INT( (DisplayWidth- WindowWidth) /2)
UpperLeftY =INT( (DisplayHeight- WindowHeight) /2)

BackgroundColor\$ = "Green"
ForegroundColor\$ = "blue"
TextboxColor\$ = "yellow"

BUTTON #A.1 "Quit", [quit],UL, 300, 530, 70, 25
BUTTON #A.2 "Again", [getInp], UL, 25, 530, 70, 25
BUTTON #A.3, "info", [info], UL, 164, 530, 70, 25

BUTTON #A.4, " Calculate ",[enter],UL, 150,470
BUTTON #A.Default, "",[enter], UL, 0, 0, 0, 0

STATICTEXT #A "BMI AND BMR", 135,10, 250, 25

TEXTBOX #A.txtbox1, 265,250,60,30
TEXTBOX #A.txtbox2, 265,300,60,30
TEXTBOX #A.txtbox3, 265,350,60,30
TEXTBOX #A.txtbox4, 265,400,60,30
TEXTBOX #A.txtbox5, 10,250, 240, 30
TEXTBOX #A.txtbox6, 10,300, 240, 30
TEXTBOX #A.txtbox7, 10,350, 240, 30
TEXTBOX #A.txtbox8, 10,400, 240, 30

GRAPHICBOX #A.BMIresult, 30, 40, 330, 30
GRAPHICBOX #A.BMRresult, 30, 80, 330, 30

OPEN "BMI AND BMR" FOR DIALOG AS #A

#A "font Times_New_Roman 14"
#A.BMIresult "color red"
#A.BMRresult "color red"
#A.BMIresult "font times_new_roman 14"
#A.BMRresult "font times_new_roman 14"

#A.txtbox5 " Gender (M=Male,F=Femal) "
#A.txtbox6 " Age in (years)"
#A.txtbox7 " Height ( in Centimetre)" 'xxxxxxxxx
#A.txtbox8 " Weight ( in kg)"'xxxxxxxxxxx

#A.BMIresult "fill cyan ; backcolor cyan"
#A.BMRresult "fill cyan ; backcolor cyan"
#A "trapclose [quit]"
[getInp]

'Clears input text if doing again
#A.txtbox1, "m"
#A.txtbox2, "40"
#A.txtbox3, "170"
#A.txtbox4, "70"
#A.BMIresult, ""'XXXXXXXX DOES NOT WORK ????
#A.BMIresult "fill cyan ; backcolor cyan"
#A.BMRresult "fill cyan ; backcolor cyan"

WAIT

[enter]
PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
PRINT #A.txtbox2, "!contents? y" 'Get Age in (year)
PRINT #A.txtbox3, "!contents? h" 'Get Height in (cm)
PRINT #A.txtbox4, "!contents? w" 'Get weight in (kg)

BMI =0.1 *int( 10 *w /((h/100)^2) )
key\$ = Inkey\$
if g\$="f" then goto [female]
if g\$="m" then goto [male]

[female]
BMR = 655 + ( 9.6 * w ) + ( 1.8 * h ) - ( 4.7 * a )

[male]
BMR = 66 + ( 13.7 * w ) + ( 5 * h ) - ( 6.8 * a )

#A.BMIresult "place 5 20"
#A.BMRresult "place 5 20"

select case
case BMI < 18.5
#A.BMIresult "\BMI= "; BMI; " --> under weight"

case BMI < 25
#A.BMIresult "\BMI= "; BMI; " --> normal weight"

case BMI < 30
#A.BMIresult "\BMI= "; BMI; " --> over weight"

case BMI < 35
#A.BMIresult "\BMI= "; BMI; " --> fatness"

case BMI < 40
#A.BMIresult "\BMI= "; BMI; " --> severe fatness"

case BMI >=40
#A.BMIresult "\BMI= "; BMI; " --> extreme fatness"
end select

select case
case g\$ ="f"

#A.BMRresult "\FEMALE BMR= "; BMR; " Calories/day"
case g\$ ="m"

#A.BMRresult "\MALE BMR= "; BMR; " Calories/day"
end select

wait

[info]
WindowWidth = 350
WindowHeight = 430

BackgroundColor\$ = "red"
ForegroundColor\$ = "white"
UpperLeftX = INT( (DisplayWidth- WindowWidth) /2)+370
UpperLeftY = INT( (DisplayHeight- WindowHeight) /2)+0

statictext #info.stext1, "BMI Calculator is to Calculate the BMI =Body Mass Index", 22, 16, 312, 20
statictext #info.stext2, "BMI=18.4 or less = under weight ", 22, 36,312, 20
statictext #info.stext3, "BMI=18.5-24. 9 = normal weight", 22, 56,312, 20
statictext #info.stext4, "BMI=25-29.9 = over weight", 22, 76,312, 20
statictext #info.stext5, "BMI=30-34.9 = fatness ", 22, 96, 312, 20
statictext #info.stext6, "BMI=35-39.9 = severe fatness", 22,116, 312, 20
statictext #info.stext7, "BMI=40 or more = extreme fatness ", 22,136, 312, 20
statictext #info.stext8, " ", 22,156, 312, 20
statictext #info.stext9, "The BMR Calculator will calculate Basal Metabolic Rate. It is ", 22, 176, 312, 20
statictext #info.stext10, "the number of calories needed to sustain life in a resting individual." , 22, 196,312, 20
statictext #info.stext11, "It could be the amount of energ expended by the body to remain", 22, 216,312, 20
statictext #info.stext11, "in bed asleep all day! ", 22, 236,312, 20

button #info.OK, "OK", [closeinfoBox] , UL, 255, 370, 64, 35

open "BMI AND BMR" for window_popup as #info
wait

[closeinfoBox]
close #info
wait
[quit]
CLOSE #A
END
• There is no need to use two buttons. Instead of: BUTTON #A.4, Calculate ,[enter],UL, 150,470 BUTTON #A.Default, ,[enter], UL, 0, 0, 0, 0 Use only: BUTTON
Message 3 of 8 , Jan 31, 2010
There is no need to use two buttons.

BUTTON #A.4, " Calculate ",[enter],UL, 150,470
BUTTON #A.Default, "",[enter], UL, 0, 0, 0, 0

Use only:
BUTTON #A.Default, " Calculate ",[enter],UL, 150,470

---

> #A.BMIresult, ""'XXXXXXXX DOES NOT WORK ????

Because the control is a graphics box and you need to use the CLS method to clear it.

#A.BMIresult "cls"

---

>
> [enter]
> PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
> PRINT #A.txtbox2, "!contents? y" 'Get Age in (year)
> PRINT #A.txtbox3, "!contents? h" 'Get Height in (cm)
> PRINT #A.txtbox4, "!contents? w" 'Get weight in (kg)
>
> BMI =0.1 *int( 10 *w /((h/100)^2) )
> key\$ = Inkey\$
> if g\$="f" then goto [female]
> if g\$="m" then goto [male]
>
>
>
> [female]
> BMR = 655 + ( 9.6 * w ) + ( 1.8 * h ) - ( 4.7 * a )
>
> [male]
> BMR = 66 + ( 13.7 * w ) + ( 5 * h ) - ( 6.8 * a )
>

You are getting the years as y, but your formula is using a as years (Latin anus).

Because you use goto instead of a block IF, you are falling through to the male BMR in any case.
Use the debugger and single step through your program, then you will easily find your mistakes.

The following should do what you want as long as the formula is correct.

'---code start (watch for line wraps)
[enter]
PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
PRINT #A.txtbox2, "!contents? a" 'Get Age in (year)
PRINT #A.txtbox3, "!contents? h" 'Get Height in (cm)
PRINT #A.txtbox4, "!contents? w" 'Get weight in (kg)

BMI =0.1 *int( 10 *w /((h/100)^2) )
' key\$ = Inkey\$ <<--- why would you need this?

if g\$="f" then
'female
BMR = 655 + ( 9.6 * w ) + ( 1.8 * h ) - ( 4.7 * a )
else
'male
BMR = 66 + ( 13.7 * w ) + ( 5 * h ) - ( 6.8 * a )
end if
'---code end

---
Stefan Pendl

Liberty BASIC Assist 4.03 ........ http://www.libertybasic.com/assist.html
Liberty BASIC 4.04 public beta ... http://www.libertybasic.com/lb404b3setup.exe

Books at http://www.lulu.com/
APIs for Liberty BASIC ..................... by Alyce
Beginning Programming with Liberty BASIC ... by Carl

Windows Vista Home Premium 32-bit SP2
AMD Turion X2 RM-70 2GHz, 4GB RAM
• Thank you so much stefan, I have noticed if the location of #A.BMIresult is   place 5 20 then the location of BMRresult should be place 0 20 To have them
Message 4 of 8 , Jan 31, 2010
Thank you so much stefan,
I have noticed if the location of #A.BMIresult is
"place 5 20"
then the location of BMRresult should be
"place 0 20"
To have them in symmetrical locations. why ??
I made notice code to any non numeric value if entered for needed txtbox, it is ok
I also made notice code for Gender to avoid using numeric value, the used letters are
either small m or f.
Thank you
'The code
nomainwin
WindowWidth = 400
WindowHeight = 600
UpperLeftX =INT( (DisplayWidth- WindowWidth) /2)
UpperLeftY =INT( (DisplayHeight- WindowHeight) /2)
BackgroundColor\$ = "Green"
ForegroundColor\$ = "blue"
TextboxColor\$ = "yellow"
BUTTON #A.1 "Quit", [quit],UL, 300, 530, 70, 25
BUTTON #A.2 "Again", [getInp], UL, 25, 530, 70, 25
BUTTON #A.3, "info", [info], UL, 164, 530, 70, 25
BUTTON #A.Default, " Calculate ",[enter],UL, 150,470
'BUTTON #A.4, " Calculate ",[enter],UL,  150,470
'BUTTON #A.Default, "",[enter], UL, 0, 0, 0, 0
STATICTEXT #A "BMI AND BMR", 135,10, 250, 25
TEXTBOX #A.txtbox1, 265,250,60,30
TEXTBOX #A.txtbox2, 265,300,60,30
TEXTBOX #A.txtbox3,  265,350,60,30
TEXTBOX #A.txtbox4, 265,400,60,30
TEXTBOX #A.txtbox5, 10,250, 240, 30
TEXTBOX #A.txtbox6, 10,300, 240, 30
TEXTBOX #A.txtbox7, 10,350, 240, 30
TEXTBOX #A.txtbox8, 10,400, 240, 30
'GRAPHICBOX #A.txtbox8, 10,400, 240, 30
GRAPHICBOX #A.BMIresult, 30, 40, 330, 30
GRAPHICBOX #A.BMRresult, 30, 80, 330, 30
OPEN "BMI AND BMR" FOR DIALOG AS #A
'open " BMI AND BMR" for dialog_popup as #A
#A "font Times_New_Roman 14"
#A.BMIresult "color red"
#A.BMRresult "color red"
#A.BMIresult "font times_new_roman 14"
#A.BMRresult "font times_new_roman 14"
#A.txtbox5 " Gender (M=Male,F=Femal)"
#A.txtbox6 " Age in (years)"
#A.txtbox7 " Height  ( in Centimetre)"
#A.txtbox8 " Weight  ( in kg)"
#A "trapclose [quit]"
[getInp]
'Clears  input text if doing again
#A.txtbox1, "m"
#A.txtbox2, "40"
#A.txtbox3, "170"
#A.txtbox4, "70"
'  #A.BMIresult "cls" 'SSSSSSSSSSSSSSS
'  #A.BMRresult "cls" No need for them
#A.BMIresult "fill cyan ; backcolor cyan"
#A.BMRresult "fill cyan ; backcolor cyan"
WAIT
[enter]
PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
PRINT #A.txtbox2, "!contents? a" 'Get Age in (year)
PRINT #A.txtbox3, "!contents? h" 'Get Height in (cm)
PRINT #A.txtbox4, "!contents? w" 'Get weight in (kg)
if h=0 or w=0 or a=0  then notice "Please enter all proper inputs ":wait
if g\$="0"  or g\$ <>"f" and g\$<>"m" then notice "Please enter all proper inputs ":wait
BMI =0.1 *int( 10 *w /((h/100)^2) )
if g\$="f" then
BMR = 655 + ( 9.6 * w ) + ( 1.8 * h ) - ( 4.7 * a )
else
BMR = 66 + ( 13.7 * w ) + ( 5 * h ) - ( 6.8 * a )
end if
#A.BMIresult "place 5 20"
#A.BMRresult "place 0 20"
select case
case BMI < 18.5
#A.BMIresult "\BMI = "; BMI; "     under weight"
case BMI < 25
#A.BMIresult "\BMI = "; BMI; "     normal weight"
case BMI < 30
#A.BMIresult "\BMI = "; BMI; "     over weight"
case BMI < 35
#A.BMIresult "\BMI = "; BMI; "     fatness"
case BMI < 40
#A.BMIresult "\BMI = "; BMI; "     severe fatness"
case BMI >=40
#A.BMIresult "\BMI = "; BMI; "     extreme fatness"
end select

select case
case g\$ ="f"
#A.BMRresult "\ BMR= "; BMR; "   Calories/day"
case g\$ ="m"
#A.BMRresult "\ BMR= "; BMR; "   Calories/day"
end select
wait
[info]
WindowWidth = 350
WindowHeight = 430
BackgroundColor\$ = "red"
ForegroundColor\$ = "white"
UpperLeftX = INT( (DisplayWidth- WindowWidth) /2)+330
UpperLeftY = INT( (DisplayHeight- WindowHeight) /2)+0
statictext #info.stext1, "BMI Calculator is to Calculate the BMI =Body Mass Index", 22, 16, 312, 20
statictext #info.stext2, "BMI=18.4 or less = under weight ", 22, 36,312, 20
statictext #info.stext3, "BMI=18.5-24. 9 = normal weight", 22, 56,312, 20
statictext #info.stext4, "BMI=25-29.9 = over weight", 22, 76,312, 20
statictext #info.stext5, "BMI=30-34.9 = fatness ", 22, 96, 312, 20
statictext #info.stext6, "BMI=35-39.9 = severe fatness", 22,116, 312, 20
statictext #info.stext7, "BMI=40 or more = extreme fatness ", 22,136, 312, 20
statictext #info.stext8, " ", 22,156, 312, 20
statictext #info.stext9, "The BMR Calculator will calculate Basal Metabolic Rate. It is ", 22, 176, 312, 20
statictext #info.stext10, "the number of calories needed to sustain life in a resting individual.", 22, 196,312, 20
statictext #info.stext11, "It could be the amount of energ expended by the body to remain", 22, 216,312, 20
statictext #info.stext11, "in bed asleep all day! ", 22, 236,312, 20
button #info.OK, "OK", [closeinfoBox] , UL, 255, 370, 64, 35
'open " BMI Calculator v1" for dialog_modal as #info
open " BMI AND BMR" for window_popup as #info
wait
[closeinfoBox]
close #info
wait
[quit]
CLOSE #A
END

'code ended

--- On Sun, 1/31/10, Stefan Pendl <pendl2megabit@...> wrote:

From: Stefan Pendl <pendl2megabit@...>
Subject: RE: [libertybasic] BMI AND BMR
To: libertybasic@yahoogroups.com
Date: Sunday, January 31, 2010, 10:35 AM

There is no need to use two buttons.

BUTTON #A.4, " Calculate ",[enter],UL, 150,470
BUTTON #A.Default, "",[enter], UL, 0, 0, 0, 0

Use only:
BUTTON #A.Default, " Calculate ",[enter],UL, 150,470

---

> #A.BMIresult, ""'XXXXXXXX DOES NOT WORK ????

Because the control is a graphics box and you need to use the CLS method to clear it.

#A.BMIresult "cls"

---

>
> [enter]
> PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
> PRINT #A.txtbox2, "!contents? y" 'Get Age in (year)
> PRINT #A.txtbox3, "!contents? h" 'Get Height in (cm)
> PRINT #A.txtbox4, "!contents? w" 'Get weight in (kg)
>
> BMI =0.1 *int( 10 *w /((h/100)^2) )
> key\$ = Inkey\$
> if g\$="f" then goto [female]
> if g\$="m" then goto [male]
>
>
>
> [female]
> BMR = 655 + ( 9.6 * w ) + ( 1.8 * h ) - ( 4.7 * a )
>
> [male]
> BMR = 66 + ( 13.7 * w ) + ( 5 * h ) - ( 6.8 * a )
>

You are getting the years as y, but your formula is using a as years (Latin anus).

Because you use goto instead of a block IF, you are falling through to the male BMR in any case.
Use the debugger and single step through your program, then you will easily find your mistakes.

The following should do what you want as long as the formula is correct.

'---code start (watch for line wraps)
[enter]
PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
PRINT #A.txtbox2, "!contents? a" 'Get Age in (year)
PRINT #A.txtbox3, "!contents? h" 'Get Height in (cm)
PRINT #A.txtbox4, "!contents? w" 'Get weight in (kg)

BMI =0.1 *int( 10 *w /((h/100)^2) )
' key\$ = Inkey\$ <<--- why would you need this?

if g\$="f" then
'female
BMR = 655 + ( 9.6 * w ) + ( 1.8 * h ) - ( 4.7 * a )
else
'male
BMR = 66 + ( 13.7 * w ) + ( 5 * h ) - ( 6.8 * a )
end if
'---code end

iberty BASIC Assist 4.03 ........ http://www.libertyb asic.com/ assist.html
Liberty BASIC 4.04 public beta ... http://www.libertyb asic.com/ lb404b3setup. exe

Books at http://www.lulu com/
APIs for Liberty BASIC ............ ......... by Alyce
Beginning Programming with Liberty BASIC ... by Carl

Windows Vista Home Premium 32-bit SP2
AMD Turion X2 RM-70 2GHz, 4GB RAM

[Non-text portions of this message have been removed]
• ... There is a space before the BMR, but none before the BMI. ... To check case insensitive, convert the input to lower case before checking. ---code start
Message 5 of 8 , Jan 31, 2010
>
> Thank you so much stefan,
> I have noticed if the location of #A.BMIresult is
>  "place 5 20"
> then the location of BMRresult should be
> "place 0 20"
> To have them in symmetrical locations. why ??
> I made notice code to any non numeric value if entered for
> needed txtbox, it is ok
> I also made notice code for Gender to avoid using numeric
> value, the used letters are
> either small m or f.
> Thank you

There is a space before the BMR, but none before the BMI.

---

To check case insensitive, convert the input to lower case before checking.

'---code start (watch for line wraps)
[enter]
PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
PRINT #A.txtbox2, "!contents? a" 'Get Age in (year)
PRINT #A.txtbox3, "!contents? h" 'Get Height in (cm)
PRINT #A.txtbox4, "!contents? w" 'Get weight in (kg)

g\$ = lower\$(g\$)

if h=0 or w=0 or a=0  then notice "Please enter all proper inputs ":wait
if g\$<>"f" and g\$<>"m" then notice "Please enter all proper inputs ":wait
'---code end

---
Stefan Pendl

Liberty BASIC Assist 4.03 ........ http://www.libertybasic.com/assist.html
Liberty BASIC 4.04 public beta ... http://www.libertybasic.com/lb404b3setup.exe

Books at http://www.lulu.com/
APIs for Liberty BASIC ..................... by Alyce
Beginning Programming with Liberty BASIC ... by Carl

Windows Vista Home Premium 32-bit SP2
AMD Turion X2 RM-70 2GHz, 4GB RAM
• ... . . ... . . One way to do this is to make the g\$ variable a lower case character, no matter what is entered by the user: {code} [enter] PRINT #A.txtbox1,
Message 6 of 8 , Jan 31, 2010
--- In libertybasic@yahoogroups.com, salaion <salaion@...> wrote:
.
.
> I also made notice code for Gender to avoid using numeric value, the used letters are
> either small m or f.
> Thank you
.
.

One way to do this is to make the g\$ variable a lower case character, no matter what is entered by the user:
{code}
[enter]
PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
g\$ = lower\$(g\$) 'added this statement
.
.
{end code}
And then change your test statement to something like this:
{code}
if g\$ <>"f" and g\$ <> "m" then notice "Please enter all proper inputs":wait
{end code}

Jack
• Thank you so much Stefan Pendle ... From: Stefan Pendl Subject: RE: [libertybasic] BMI AND BMR To: libertybasic@yahoogroups.com Date:
Message 7 of 8 , Feb 1, 2010
Thank you so much Stefan Pendle
--- On Sun, 1/31/10, Stefan Pendl <pendl2megabit@...> wrote:

From: Stefan Pendl <pendl2megabit@...>
Subject: RE: [libertybasic] BMI AND BMR
To: libertybasic@yahoogroups.com
Date: Sunday, January 31, 2010, 11:58 PM

>
> Thank you so much stefan,
> I have noticed if the location of #A.BMIresult is
>  "place 5 20"
> then the location of BMRresult should be
> "place 0 20"
> To have them in symmetrical locations. why ??
> I made notice code to any non numeric value if entered for
> needed txtbox, it is ok
> I also made notice code for Gender to avoid using numeric
> value, the used letters are
> either small m or f.
> Thank you

There is a space before the BMR, but none before the BMI.

---

To check case insensitive, convert the input to lower case before checking.

'---code start (watch for line wraps)
[enter]
PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
PRINT #A.txtbox2, "!contents? a" 'Get Age in (year)
PRINT #A.txtbox3, "!contents? h" 'Get Height in (cm)
PRINT #A.txtbox4, "!contents? w" 'Get weight in (kg)

g\$ = lower\$(g\$)

if h=0 or w=0 or a=0  then notice "Please enter all proper inputs ":wait
if g\$<>"f" and g\$<>"m" then notice "Please enter all proper inputs ":wait
'---code end

---
Stefan Pendl

Liberty BASIC Assist 4.03 ........ http://www.libertyb asic.com/ assist.html
Liberty BASIC 4.04 public beta ... http://www.libertyb asic.com/ lb404b3setup. exe

Books at http://www.lulu com/
APIs for Liberty BASIC ............ ......... by Alyce
Beginning Programming with Liberty BASIC ... by Carl

Windows Vista Home Premium 32-bit SP2
AMD Turion X2 RM-70 2GHz, 4GB RAM

[Non-text portions of this message have been removed]
• Thanks a lot Jack ... From: paradisejb Subject: [libertybasic] Re: BMI AND BMR To: libertybasic@yahoogroups.com Date: Monday,
Message 8 of 8 , Feb 1, 2010
Thanks a lot Jack

--- On Mon, 2/1/10, paradisejb <jburman1860@...> wrote:

Subject: [libertybasic] Re: BMI AND BMR
To: libertybasic@yahoogroups.com
Date: Monday, February 1, 2010, 12:04 AM

--- In libertybasic@ yahoogroups. com, salaion <salaion@... > wrote:
.
.
> I also made notice code for Gender to avoid using numeric value, the used letters are
> either small m or f.
> Thank you
.
.

One way to do this is to make the g\$ variable a lower case character, no matter what is entered by the user:
{code}
[enter]
PRINT #A.txtbox1, "!contents? g\$" 'Get Gender in (Type)
g\$ = lower\$(g\$) 'added this statement
.
.
{end code}
And then change your test statement to something like this:
{code}
if g\$ <>"f" and g\$ <> "m" then notice "Please enter all proper inputs":wait
{end code}

Jack

[Non-text portions of this message have been removed]
Your message has been successfully submitted and would be delivered to recipients shortly.