Caloric intake
Caloric intake
Caloric intake
Caloric intake
Caloric intake
Caloric intake Caloric intake Caloric intake Caloric intake Caloric intake Caloric intake Caloric intake Caloric intake
Caloric intake Caloric intake
Caloric intake
Go Back  Xtreme Visual Basic Talk > > > Caloric intake


Reply
 
Thread Tools Display Modes
  #1  
Old 12-17-2009, 08:00 PM
vbnoob209 vbnoob209 is offline
Newcomer
 
Join Date: Dec 2009
Location: California, USA
Posts: 3
Exclamation Caloric intake


ok for my computer programming final we have to make a program for the calorie intake and since my teacher doesn't teach us i need help
here's what it says:
write a program that will tell the user how much protein, carbohydrates, and fat they should consume daily(in grams) basted on the input weight and whether they choose to lose, gain or maintain. It should give the user the daily intake.

Then it gives you the % and gram to calories (listed below)
Carbo: 55% of calorie intake
Protein: 25% of calorie intake
Fats: 20% of calorie intake

Carbo: 1 gram = 4 calories
Protein: 1 gram = 4 calories
Fats: 1 gram = 9 calories

It should have 3 buttons (one to clear, one to exit, and one calculate)
3 radiobuttons that let you choose to gain, loose, or maintain weight
2 text boxes (one to enter weight and one to output the calories)
from that point idk what to do I know how to clear the boxes with the clear button and how to close it with the exit button
PLEASE HELP!!!!
Reply With Quote
  #2  
Old 12-17-2009, 08:15 PM
Iceplug's Avatar
IceplugCaloric intake Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Uh... okay have you started anywhere on this project yet? Have you done any coding towards what you want to get accomplished?
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #3  
Old 12-17-2009, 08:22 PM
vbnoob209 vbnoob209 is offline
Newcomer
 
Join Date: Dec 2009
Location: California, USA
Posts: 3
Default

I have all the stuff listed and the clear button and the exit button work. but like idk how to make the weight to convert to calories also there's and a formula to have the carvo, protein, and fats based on the weight entered. I forgot to add the calculation so i'll add once i find the paper again
Reply With Quote
  #4  
Old 12-18-2009, 11:15 AM
vbnoob209 vbnoob209 is offline
Newcomer
 
Join Date: Dec 2009
Location: California, USA
Posts: 3
Default

got it
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoStay.CheckedChanged

End Sub

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txbWeight.Text = " "
txbCalories.Text = " "
End Sub

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

Dim BodyWeight As Double
Dim Calories As Integer
Dim CaloricIntake As String
BodyWeight = txbWeight.Text
If rdoStay.Checked Then
CaloricIntake = txbWeight.Text * 12
txbCalories.Text = CaloricIntake.ToString
End If
If rdoLose.Checked Then
Calories = BodyWeight * 10
txbCalories.Text = Calories.ToString
End If
If rdoGain.Checked Then
Calories = BodyWeight * 15
txbCalories.Text = Calories.ToString
End If
End Sub
End Class
Reply With Quote
  #5  
Old 12-19-2009, 11:49 AM
jojoofu jojoofu is offline
Newcomer
 
Join Date: Dec 2009
Posts: 11
Exclamation

You may want to include some sort of error checking in your application

Code:
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        'make an integer to hold number of calories
        Dim calories As Integer
        'check to see if value entered is a number
        If IsNumeric(TextBox1.Text) = True Then
            'if a number then convert type
            MessageBox.Show("test")
            calories = CType(TextBox1.Text, Integer)
        Else
            'if not a number clear box
            TextBox1.Text = ""
        End If

    End Sub
The code above can check to see if the text in the textbox is an integer. If text is not an integer it clears the box. If it is an integer it coverts the string data to an integer type. Conversions are important when working with two different data types multiplying a string by and integer can produce fatal errors.
Reply With Quote
Reply

Tags
calories, final, microsoft, test, visual basic


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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Caloric intake
Caloric intake
Caloric intake Caloric intake
Caloric intake
Caloric intake
Caloric intake Caloric intake Caloric intake Caloric intake Caloric intake Caloric intake Caloric intake
Caloric intake
Caloric intake
 
Caloric intake
Caloric intake
 
-->