| View previous topic :: View next topic |
| Author |
Message |
Kingdom Grandmaster Cheater Supreme
Reputation: 0
Joined: 16 Jan 2007 Posts: 1638
|
Posted: Wed Apr 09, 2008 7:22 am Post subject: Help in Java! |
|
|
Who is good at programming in Java?
_________________
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Wed Apr 09, 2008 8:19 am Post subject: |
|
|
| Please post the problem.
|
|
| Back to top |
|
 |
newb09 Master Cheater
Reputation: 0
Joined: 02 Feb 2007 Posts: 350
|
Posted: Wed Apr 09, 2008 12:33 pm Post subject: |
|
|
lol i mean depends on what you wanna do as he said post problem
_________________
NOOBXOR = Comes from the root words noob and haxor, hence noobxor.
word created by: newb09 & ferenzo
 |
|
| Back to top |
|
 |
Kingdom Grandmaster Cheater Supreme
Reputation: 0
Joined: 16 Jan 2007 Posts: 1638
|
Posted: Wed Apr 09, 2008 12:46 pm Post subject: |
|
|
I need help with this assignment...
If someone can do it or just help out that would be nice...=)
+Rep for helping!
The Body Mass Index (BMI) is a calculation used by doctors to assess a person’s health. The BMI is calculated using the formula:
BMI = weight
height2
Create a program that prompts the user for a patient’s height (in meters) and weight (in kg’s) and calculates the BMI and displays the corresponding message:
BMI Category Message
> 25 Overweight
> 18.5 and <= 25.0 Normal weight
< 18.5 Underweight
Example:
Input Weight:69
Input Height: 1.73
Output: BMI is 23.05 - Normal weight
_________________
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Wed Apr 09, 2008 1:19 pm Post subject: |
|
|
Try this: | Code: | public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
double Weight,Height,BMI;
System.out.println("Enter Weight:");
Weight = in.nextDouble();
System.out.println("Enter Height:");
Height = in.nextDouble();
BMI = Weight/(Height*Height);
if (BMI>25)
System.out.println("BMI is "+BMI+" - Overweight.");
else
if ((BMI<=25)&&(BMI>18.5))
System.out.println("BMI is "+BMI+
" - Normal weight.");
else
if (BMI<=18.5)
System.out.println("BMI is "+BMI
+" - Underweight.");
} |
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Wed Apr 09, 2008 4:41 pm Post subject: |
|
|
| Quote: | I need help with this assignment...
If someone can do it... |
If you don't do the work, you'll never understand it or get better.
|
|
| Back to top |
|
 |
Kingdom Grandmaster Cheater Supreme
Reputation: 0
Joined: 16 Jan 2007 Posts: 1638
|
Posted: Thu Apr 10, 2008 6:41 am Post subject: |
|
|
What class is the scanner in?
_________________
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Thu Apr 10, 2008 8:57 am Post subject: |
|
|
| I think java.util.Scanner.
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Thu Apr 10, 2008 11:47 am Post subject: |
|
|
| Did you even try coding this yourself?
|
|
| Back to top |
|
 |
Kingdom Grandmaster Cheater Supreme
Reputation: 0
Joined: 16 Jan 2007 Posts: 1638
|
Posted: Thu Apr 10, 2008 6:56 pm Post subject: |
|
|
Yeah, I did.
Then it just got confusing and my head was hurting so I was like meh...
_________________
|
|
| Back to top |
|
 |
|