Results 1 to 3 of 3
  1. #1
    floods7 is offline Member
    Join Date
    Sep 2012
    Posts
    1
    Rep Power
    0

    Default 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

    -----------------------------------------------------------------------------------

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,903
    Rep Power
    25

    Default 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 Forum
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: noob here -- first java program -- please take a look

    Please go through the Forum Rules -- particularly the third paragraph

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Noob Question on simple RockPaperScissors program.
    By Subspec in forum New To Java
    Replies: 1
    Last Post: 12-22-2011, 03:40 PM
  2. Help with GUI - Java NOOB :(
    By bdelarosa7 in forum New To Java
    Replies: 3
    Last Post: 11-22-2011, 10:54 PM
  3. Help im a noob.. a super noob on java..
    By critdevil in forum New To Java
    Replies: 12
    Last Post: 03-07-2009, 04:17 AM
  4. Hello, Java Noob
    By furry in forum Introductions
    Replies: 0
    Last Post: 10-07-2008, 08:39 PM
  5. Ah! Help a Java Noob
    By Snejana in forum New To Java
    Replies: 4
    Last Post: 01-24-2008, 04:52 AM

Posting Permissions

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