any input would be appreciated

diceman76

New member
Joined
Feb 9, 2020
Messages
3
Programming Experience
Beginner
using System;
class MainClass {
public static void Main (string[] args) {
Console.WriteLine ("Please enter your weight in pounds");
Input weight;
Console.WriteLine ("Please enter your height in inches");
Input height;
Input BMI=weight*703/(height*height);
Console.WriteLine ("Your body mass Index is BMI");
if(BMI>25)
Display("You are somewhat overweight.");
else if(BMI<18.5);
Display("You are somewhat underweight.");
else(BMI<18.5 && BMI<=25);
Display ("Congratulations! You are within a healthy weight range.");
}
}
 
insertcode.png
 
I assume you will show us your implementation of the class Input? You seem to be using instances of that class for the variables weight, height, and BMI. (lines 5, 7-8)
 
Just posting some code with no explanation is not acceptable. You need to provide a FULL and CLEAR explanation of the whole problem, i.e. exactly what you're trying to achieve, how you're trying to achieve it and what happens when you try. You also need to provide a title that summarises the whole thing. We should never have to guess what you're trying to do from code that doesn't do it.

That said, in this case there are some fairly obvious problems. You clearly haven't debugged that code, so your first order of business should be learning how to debug. As for the code, you prompt the user for weight and height and you declare variables for the data but you never actually get any data from the user. It seems like you expect that declaring a variable as type Input is going to do that. It's not. I'm guessing that you were given an instruction to get input from the user and that's your interpretation of that. It's not. I'd be surprised if you hadn't already been taught how to get user input but there's no evidence of that in anything you've posted, which is part of the problem. Consult your notes or text on how to do that and, if you can't find it, search the web as a next option.
 
This thread looks to be a follow up on the OP's other thread:
 
Back
Top Bottom