Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Estimating the adult height of a child

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Estimating the adult height of a child

    I am trying to write a program that takes as input the gender of a child, the height of the mother in inches, and the height of the father in inches, and outputs the estimated adult height of the child in inches. I think I have to use a loop, but not sure. Also getting illegal start type error's and cannot find symbol errors. Here is what I have so far

    package labassignment3;
    /**
    *
    * @author Edgar
    */
    import java.util.Scanner;

    public class LabAssignment3 {
    public static void main(String[] args) {
    String line;
    Scanner keyboard = new Scanner(System.in);

    System.out.println("Enter the gender of your child:");
    line = keyboard.nextLine();
    System.out.println("Enter your mother's height in inches:");
    line = keyboard.nextLine();
    System.out.println("Enter the height of your father in inches:");
    line = keyboard.nextLine();
    //System.exit(0);
    int maleChild = 0;
    int femaleChild = 0;
    int H_Mother = 0;
    int H_Father = 0;

    // This is the mathmatical formula for a male child
    //maleChild H_Mother * 13/12)+ H_Father)/2;
    //This is the formula for female child
    //femaleChild = ((H_Father * 12/13)+ H_Mother)/2;
    }
    if (keyboard.nextLine == female)
    System.out.println("Enter the height of your father in inches:");
    System.out.println("Enter your mother's height in inches:");

    else
    {
    (keyboard.nextLine == male)
    System.out.println("Enter your mother's height in inches:");
    System.out.println("Enter the height of your father in inches:");
    System.out.println(((H_Mother * 13/12)+ H_Father)/2);
    }
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,140
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Estimating the adult height of a child

    Please post the full text of the error messages.

    When posting code, please wrap it in code tags.
    Edit your post and wrap your code with[code=java]<YOUR CODE HERE>[/code] to get highlighting

Similar Threads

  1. Getting data back from a child form
    By ishtar in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 5th, 2011, 08:49 AM
  2. How to insert a proper child in the XML Doc
    By Sarakh in forum What's Wrong With My Code?
    Replies: 0
    Last Post: August 31st, 2010, 12:36 PM
  3. JButton Width & Height
    By Howdy_McGee in forum Java Theory & Questions
    Replies: 4
    Last Post: May 22nd, 2010, 07:12 AM
  4. Reading the size (height and width) of word documents
    By pradeep_das in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: May 7th, 2010, 09:58 AM
  5. Getting table height using JSTL
    By jsnx7 in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: March 19th, 2009, 12:03 PM