Results 1 to 3 of 3
- 09-10-2012, 02:33 AM #1
Member
- Join Date
- Sep 2012
- Posts
- 1
- Rep Power
- 0
noob here -- first java program -- please take a look
Im making a program that converts your BMI.
When I go to run it, I get errors.
Here is my code:
------------------------------------------------------------------------------
import java.util.Scanner;
public class BmiCalculator {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter weight in pounds: ");
long weight = input.nextlong();
System.out.print("Enter height in inches: ");
long height = input.nextlong();
long BMI =(weight*.45359237)/(height*.0254);
System.out.print(BMI);
}
}
--------------------------------------------------------------------------
Here is the outout in CMD:
---------------------------------------------------------------------------
c:\java>javac BmiCalculator.java
BmiCalculator.java:12: error: cannot find symbol
long weight = input.nextlong();
^
symbol: method nextlong()
location: variable input of type Scanner
BmiCalculator.java:15: error: cannot find symbol
long height = input.nextlong();
^
symbol: method nextlong()
location: variable input of type Scanner
BmiCalculator.java:17: error: possible loss of precision
long BMI =(weight*.45359237)/(height*.0254);
^
required: long
found: double
3 errors
-----------------------------------------------------------------------------------
- 09-10-2012, 03:30 AM #2
Re: noob here -- first java program -- please take a look
Check your spelling. Java is case sensitive.
Please wrap you code in code tags. See: BB Code List - Java Programming ForumIf you don't understand my response, don't ignore it, ask a question.
- 09-10-2012, 06:28 AM #3
Re: noob here -- first java program -- please take a look
Please go through the Forum Rules -- particularly the third paragraph
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Noob Question on simple RockPaperScissors program.
By Subspec in forum New To JavaReplies: 1Last Post: 12-22-2011, 02:40 PM -
Help with GUI - Java NOOB :(
By bdelarosa7 in forum New To JavaReplies: 3Last Post: 11-22-2011, 09:54 PM -
Help im a noob.. a super noob on java..
By critdevil in forum New To JavaReplies: 12Last Post: 03-07-2009, 03:17 AM -
Hello, Java Noob
By furry in forum IntroductionsReplies: 0Last Post: 10-07-2008, 07:39 PM -
Ah! Help a Java Noob
By Snejana in forum New To JavaReplies: 4Last Post: 01-24-2008, 03:52 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks