❔ I need your help with this project BMI & BMR
I am super confused about this project and I don't seem to make any progress or going forward with it.
41 Replies
$details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Ok
Please Rust save me from a headache! I am so confused about the gender
The BMI one is not asking for gender/ older either, but BMR is asking for gender, height, weight and age. It seems like there is very confusion in this project 🙆🏻♂️ 🤷🏻♂️
Combining these two programs seems complicated to me at least
Did I provide too much details and this led to confuse you or are you busy right now? 🙂
well make them input if they want bmr or bmi first and then ask them for the data you need
or make them input all data and then output both metrics if you need both
what's the confusion with the age?
Ok
or the gender
it just dictates which formula to use
This is my code so far
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/please format your code
BlazeBin - ogufedgmequs
A tool for sharing your source code with the world!
So you mean the user input should be either BMI or BMR?
reformat your code pls
idk ask the teacher what they want
according to the assignment they want both
https://exlearn.arenakoncernen.se/exlearn2/CommonControls/CourseAssignmentHandler.ashx?ID=22761986&originalFile=original
Although it's written in Swedish
then do both
input then do both
But that's why I posted the thread, it's very confusing. Read above on why ☝️
well take all data you need and then calculate both
why is that confusing
Ok
BMI table
The table below applies to men and women over 18 years of age with a normal build.
BMI is combining the man and woman BMR is separating the man from the woman, what the hell 🤷🏻♂️
Easiest way to go about would be something like
Ok! Great. Thanks a lot.
Please! I've been in this project like for over two weeks and I don't understand why they combine BMI with BMR shouldn't they be two separated programs from each other? Based on your understanding.
I mean, maybe?
But you can easily have both in the same app
So no strong opinions one way or another
Ok
Ok! Easy to say, but how can I do that?
Angius#1586
Easiest way to go about would be something like
Quoted by
<@!85903769203642368> from #I need your help with this project BMI & BMR (click here)
React with ❌ to remove this embed.
This one looks clear
RunBmi()
runs the BMI "sub-app", asks for input, does calculation, returns output
RunBmr()
runs the BMR "sub-app", asks for input, does calculation, returns outputThis is where I feel stuck and confused
Why?
Treat BMI and BMR as their own thing
BMI only wants height and weight? Cool, ask only for those!
BMR also wants age and gender? Cool, ask for those, height, and weaight
Ok! Great. You made it a bit easy for me to understand what's going on. I'll try to implement thus based on your algorithm.
It seems like I would need to create two methods
Yep
Ok! But should they stay empty or what?
lol
I'm trying lol, but it's confusing for a beginner, I know you're really good at coding, I just haven't reached your level yet.
are you seriously askikg if they should be empty or are you just joking?
because it's obvious that if they're empty they'll do nothing
Yes, I know they shouldn't be empty.
I know I should do the calculation for BMI inside of the method signature
inside the body*
Yes
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.No solved yet
it's not how
double.TryParse
works
it returns a boolean and has an out
parameter which contains the double
$tryparseThe TryParse pattern is considered best practice of parsing data from a string:
- a TryParse method returns
true
or false
to inform you if it succeeded or not, so you can use it directly in a condition,
- since C# 7 you can declare a variable that will be used as an out
argument inline in an argument list,
- it forces you to check if the out
argument contains valid data afterwards,
Avoid: Convert.ToInt32 — it's a bad choice for parsing an int
. It exists only for backwards compatibility reasons and should be considered last resort. (Note: Convert does contain useful conversion methods: To/FromBase64String
, To/FromHexString
, ToString(X value, int toBase)
, ToX(string? value, int fromBase)
)
Avoid: int.Parse — you have to use a try
/catch
statement to handle invalid input, which is a less clean solution.
Use int.TryParse https://docs.microsoft.com/en-us/dotnet/api/system.int32.tryparse?view=net-5.0#System_Int32_TryParse_System_String_System_Int32__ Int32.TryParse Method (System)
Converts the string representation of a number to its 32-bit signed integer equivalent. A return value indicates whether the operation succeeded.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.