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 9 of 9

Thread: Need java code help

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need java code help

    iM NOT sure this is the right place, but i need help.......just wokeup to see a post my professor posted with extra credit on a test i probably got a 20/100 on, so plz help, its due in 1 hour suposedly......n e way heres the code.

    CodingBat getIQ

    Given a person's writing sample, estimate their IQ using the following algorithm. Sum the length of each word, multiply by 15, then divide by the number of words (truncate any fractional part). Assume words are separated by whitespace and that there is no punctuation.

    getIQ("i use short words") → 52
    getIQ("mississippi expectations exceed extraordinary") → 157
    getIQ("hello bye") → 60

    Thanks


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Need java code help

    Could you post your code here instead of providing a link?

    Be sure to use code tags. See my signature if you're unsure how to do this.

    Also, what part of your code do you need help on? Are you getting an error? If so, please post the entire error message.

    edit: also, please don't ask your question in multiple topics. I've deleted the other one.
    Last edited by helloworld922; October 17th, 2010 at 10:37 AM.

  3. #3
    Junior Member
    Join Date
    Oct 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need java code help

    no there is no code, under the link is the problem, u have to make the code answering the problem and all that they give you is

     public int getIQ(String phrase){
     
    }
    you have to complete the rest

  4. #4
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    494
    Thanks
    8
    Thanked 48 Times in 46 Posts

    Default Do your own homework

    Quote Originally Posted by Gradybaby16 View Post
    no there is no code, under the link is the problem, u have to make the code answering the problem and all that they give you is

     public int getIQ(String phrase){
     
    }
    you have to complete the rest
    No, you have to. [edit]We won't do your homework for you[/edit]

    Recommended reading:
    How To Ask Questions The Smart Way

    db
    Last edited by helloworld922; October 17th, 2010 at 03:58 PM. Reason: please keep it respectful

  5. #5
    Junior Member
    Join Date
    Oct 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need java code help

    no its not hw its extra credit, since the whole class is failing...... heres wat i have so far

    public int getIQ(String phrase){
    int strLength=0, numWord=0;
    String tempWord;
    Scanner s = new (Scanner phrase);
     
    while (true) {
    tempWord=s.next();
    strLength+=tempWord.length();
    numWord+1;
    }
     
    return strLength*15/numWord;
    }

    but it wont work

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Need java code help

    Quote Originally Posted by Gradybaby16 View Post
    but it wont work
    Then I suggest that you make it work.

    Useful questions get useful answers.

  7. #7
    Junior Member
    Join Date
    Oct 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need java code help

    I just need help, what takes me months to do would only take half of you 3 mins........i dont want to be in this class, but is required n being a new school their arent any other options......the whole class is doin bad so no one their to help me, and the prfessors are a whole nother thing when their not changing on us

  8. #8
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Need java code help

    Quote Originally Posted by Gradybaby16 View Post
    I just need help, what takes me months to do would only take half of you 3 mins........
    Yeah, and we got that way by practicing. We didn't get that way by asking other people to do our work for us.


    Quote Originally Posted by Gradybaby16 View Post
    i dont want to be in this class, but is required n being a new school their arent any other options......
    You have several options. You could rephrase your question: How To Ask Questions The Smart Way
    You could read through the basic tutorials: java tutorials - Google Search
    Or you could fail. It's up to you.

    Quote Originally Posted by Gradybaby16 View Post
    the whole class is doin bad so no one their to help me, and the prfessors are a whole nother thing when their not changing on us
    Many programmers are self-taught, so you have a leg up on them. Stop complaining. Ask a specific question. Post some code. Make an effort. Or fail.

  9. #9
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    494
    Thanks
    8
    Thanked 48 Times in 46 Posts

    Default Re: Need java code help

    Quote Originally Posted by KevinWorkman View Post
    Make an effort. Or fail.
    I foresee another moderator edit on its way

    db

Similar Threads

  1. calling c code from java
    By sara in forum Java Native Interface
    Replies: 3
    Last Post: April 6th, 2013, 09:53 PM
  2. Replies: 2
    Last Post: August 1st, 2010, 06:29 AM
  3. [SOLVED] what is wrong for the java code
    By chuikingman in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 11th, 2010, 02:00 AM
  4. Convert C/C++ code to Java
    By cristianll in forum What's Wrong With My Code?
    Replies: 13
    Last Post: November 14th, 2009, 02:43 AM
  5. Convert Java Program to Java ME code
    By rinchan11 in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: October 5th, 2009, 10:18 PM