Patient Weight Converter

Patient Weight Converter

Page 1 of 1

6 Replies - 7744 Views - Last Post: 17 February 2010 - 07:47 AM Rate Topic: -----

#1 Rampugo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 15-February 10

Patient Weight Converter

Posted 15 February 2010 - 06:13 PM

I am new to VB.net. I am taking a class in it. I am working on a project called Patient Weight Converter. I have to convert pounds to kilograms and kilograms to punds. I have to calculate it and then have it be displayed. I know i have to have input box for the person to enter there weight. Then i have two radio buttons with options of choosing covert to ppund to kilograms or convert kilograms to pounds. Which ever radio button is chosed to convert the total has to be displayed with kilograms or pounds. I know i have to take kilograms= pounds /2.2 and pounds=kilograms x 2.2.

If the value entered is greater than 500 for the conversion from pounds to kilograms or greater than 225 for the conversion from kilograms to pounds the user should be advised and asked for a valid entry.

So for this part would i use if statments ?

I would appreciate any advice. I am having trouble where to start.

Thanks again

Is This A Good Question/Topic? 0
  • +

Replies To: Patient Weight Converter

#2 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2253
  • View blog
  • Posts: 9,443
  • Joined: 29-May 08

Re: Patient Weight Converter

Posted 15 February 2010 - 06:31 PM

Yes you'll need an If statement.
Don't try to think it at the vb.net code level for the moment, but more abstractly.
Get a general outline of the task.
GETUSERINPUT UserWeight
IF VALUE OF UserWeight IS OVER 500 THEN
 DISPLAYMESSAGE "Not a valid entry"
ELSE
 GETUSEROPTION WeightUnit FROM OPTIONS { Kgs, Pounds }
 IF WeightUnit IS Kgs THEN

etc

ENDIF



Can you finish the outline (PSEUDOCODE)
Was This Post Helpful? 1
  • +
  • -

#3 pdkharkar  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 63
  • View blog
  • Posts: 345
  • Joined: 19-January 09

Re: Patient Weight Converter

Posted 15 February 2010 - 06:32 PM

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#4 Rampugo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 15-February 10

Re: Patient Weight Converter

Posted 16 February 2010 - 08:10 AM

Okay, i will post my code.
Was This Post Helpful? 0
  • +
  • -

#5 Rampugo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 15-February 10

Re: Patient Weight Converter

Posted 16 February 2010 - 08:19 AM

View PostAdamSpeight2008, on 15 February 2010 - 05:31 PM, said:

Yes you'll need an If statement.
Don't try to think it at the vb.net code level for the moment, but more abstractly.
Get a general outline of the task.
GETUSERINPUT UserWeight
IF VALUE OF UserWeight IS OVER 500 THEN
 DISPLAYMESSAGE "Not a valid entry"
ELSE
 GETUSEROPTION WeightUnit FROM OPTIONS { Kgs, Pounds }
 IF WeightUnit IS Kgs THEN

etc

ENDIF



Can you finish the outline (PSEUDOCODE)


I will try. Thanks for the help !
Was This Post Helpful? 0
  • +
  • -

#6 Rampugo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 15-February 10

Re: Patient Weight Converter

Posted 17 February 2010 - 07:32 AM

I am using the program Visual Studio 2008. I go to new project and select smart device project. Then i select device application. The target platform is windows mobile 5.0 Pocket PC SDK. The .Net Compact Framework version is 3.5.

This project for class requires me to make a Patient Weight Converter.

The mobile application converts the weight of the patients from Pounds to kilograms and kilograms to Pounds.

User enters the weight of the patient and then selects Pounds to Kilograms or kilograms to Pounds.Then the weight is converted and displayed.

The conversion formulas are
kilograms = Pounds / 2.2
Pounds = Kilograms x 2.2
Then the user must be able to clear the entered weight, conversion choice and results.

If a numeric value is entered or if the weight is left blank, the user should be advised and asked for a valid entry. If a negative number is entered for the weight, the user should be advised and asked for a valid entry.

If the value is greater than 500 for the conversion from pounds to kilograms or greater than 225 for the conversion from kilograms to pounds, the user should be advised and asked for a valid entry.

The default conversion should be pounds to kilograms.

I am unable to figure out how to get the windows symbol and the visual effects at the top bar.

I have uploaded my program. Please take a look at it and tell me what mistakes i need to fix. Thanks !



Private Sub btnDisplayWeight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayWeight.Click
Dim decEnterWeight As Decimal
Dim decConvertedWeight As Decimal
Dim decPounds = decConvertedWeight * 2.2
Dim decKilograms = decConvertedWeight / 2.2

If IsNumeric(Me.txtWeight.Text) Then decEnterWeight = Convert.ToDecimal(Me.txtWeight.Text)

If decEnterWeight > 500 Then
If Me.radConvertPounds.Checked Then decConvertedWeight = decKilograms
ElseIf Me.radConvertKilo.Checked Then decConvertedWeight = decPounds
End If
decConvertedWeight = decEnterWeight * decConvertedWeight
Me.lblConvertedWeight.Text = decConvertedWeight.ToString("c")
MsgBox ("You entered " & decEnterWeight.ToString () & _ ". Enter a numeric number." , , " Input Error" )
Me.txtWeight.Text = ""
Me.txtWeight.Focus()

MsgBox(" Enter a positive number.", , " Input Error")
Me.txtWeight.Text = ""
Me.txtWeight.Focus()

End Sub

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click

Me.txtWeight.Text = ""
Me.lblConvertedWeight.Text = ""
Me.radConvertKilo.Checked = True
Me.radConvertPounds.Checked = False
Me.txtWeight.Focus()
Was This Post Helpful? 0
  • +
  • -

#7 Rampugo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 15-February 10

Re: Patient Weight Converter

Posted 17 February 2010 - 07:47 AM

Attached is image of form i created.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1