Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 4th, 2006, 11:21 AM   #1
bison
Newbie
 
Join Date: Oct 2005
Posts: 8
Rep Power: 0 bison is on a distinguished road
need a little beginner delphi help please

ok so i need a little help with some delphi programming but i am very new to it. i have just started it in computing class and have only covered very very basic things so far. so here's my problem: i have made a simple bmi calculator and its all good but i was wondering how i could make it choose what type of measurements in the height/weight (like pounds, kilograms, stones etc) with radio buttons? i have everything else pretty much sorted but i have no idea how to start on this. here is how the code currently looks (excuse the crappiness of it):

procedure TForm1.Button1Click(Sender: TObject);
var weight:real;
var height:real;
var height2:real;
var bmi:real;
var height3:real;

begin
weight := strtofloat(edit2.text);
height := strtofloat(edit1.text);
height2 := height / 100;
height3 := height2 * height2;
bmi := weight / height3;
edit3.text :=floattostr(bmi);
if bmi >=30 then label4.caption := 'Obese';
if bmi <=18.5 then label4.caption := 'Underweight';
if (bmi >=18.5) and (bmi <=24.9) then label4.caption := 'Normal';
if (bmi >=25) and (bmi <=29.9) then label4.caption := 'Overweight';
end;

at the moment i have only got cm option for the height and only kilogram option for the weight but would like to have feet and inches as another option for height and pounds and stones for weight. i have the conversion rates and all but i am unsure what to do to get it to work. any help would be really appreciated and would help me out tonnes.

thanks alot
bison is offline   Reply With Quote
Old Jan 4th, 2006, 4:06 PM   #2
chr15
Newbie
 
Join Date: Jan 2006
Posts: 3
Rep Power: 0 chr15 is on a distinguished road
Smile

Use RadioGroup Component, and use a case statement with the RadioGroup.itemindex

C
chr15 is offline   Reply With Quote
Old Jan 4th, 2006, 4:11 PM   #3
bison
Newbie
 
Join Date: Oct 2005
Posts: 8
Rep Power: 0 bison is on a distinguished road
yeah but i need help in doing that, im very new to this. any ideas what i need to put into it?
bison is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:10 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC