CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2015
    Posts
    3

    Body mass calculator

    I am in C# Beginners class, I need help with BMI calculator, I am using Visual Basic 2015
    Hi,

    I need help with following

    1.Coding of Calculate button:

    •Convert the txtHeight and txtWeight TextBox contents using C# Convert object to a suitable data type that support whole number only.


    •Declare a new variable that is a suitable data type that can contain a decimal value that isn’t too large because it will contain a value that is has two whole number positions and a few decimal positions such as 1.829. It will store a person’s Height mathematically converted to meters using C#’s arithmetic operators.

    1.Variable name should be xxxMeters. You must choose the proper data type and replace xxx with the correct Hungarian notation

    What data type did you pick? ____________________

    What Hungarian Notation should you use? ___


    2.This new variable will contain the person’s height in meters. The formula is:

    Height / 39.36



    •Declare a new variable that is a suitable data type that can contain a decimal value that isn’t too large because it will contain a value that is has no more than three whole number positions and a few decimal positions such as 163.636. It will store a person’s Weight mathematically converted to meters using C#’s arithmetic operators.

    1.Variable name should be xxxKilograms. You must choose the proper data type and replace xxx with the correct Hungarian notation

    What data type did you pick? ____________________

    What Hungarian Notation should you use? ___


    2. This new variable will contain the person’s weight in kilograms. The formula is:

    Weight / 2.2



    •Declare a new variable that is a suitable data type that can contain a decimal value that isn’t too large because it will contain a value that is has no more than three whole number positions and a few decimal positions such as 36.8499. It will store the person’s Body Mass Index:

    1.Variable name should be xxxBMI. You must choose the proper data type and replace xxx with the correct Hungarian notation

    What data type did you pick? ____________________

    What Hungarian Notation should you use? ___


    2. This new variable will contain the person’s BMI and the formula is:

    xxxKilograms / ( xxxMeters * xxxMeters )

    Can you think of another way to multiple the xxxMeters by itself?



    Convert using C#’s ToString method and format the xxxBMI as a number with 2 decimal positions and put the formatted value into txtBodyMassIndex TextBox

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Body mass calculator

    You are in a C# class but are using Visual Basic 2015?

    Doesn't that in itself seem like a problem?

    Btw, no one is going to do your homework assignment for you.

    If you want help, you need to take a good try at coding up the solution, post your code here and specify what you are having trouble with.

    P.S. Using Hungarian notation in C# is considered bad form. Maybe your instructor didn't get the memo?
    Last edited by Arjay; October 24th, 2015 at 04:52 PM.

  3. #3
    Join Date
    Oct 2015
    Posts
    3

    Re: Body mass calculator

    I am using VISUAL STUDIO 2015. and I have done more then half of this assignment, I was stuck here, anyway

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured