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

Thread: Hw help!

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Hw help!

    Please help! I'm really lost right now!!!!

    2. Assume that an arrays has been defined:
    int[] par = new int[18];
    int[] strokes = new int[18];
    Assume that every compartment of the arrays contains an appropriate integer value representing the par value and the number of strokes made by a golfer on each hole of an eighteen hole golf course.

    a. Write a code segment that calculates and displays the number of holes upon which the golfer made an eagle. To make an eagle, the number of strokes made by the golfer must be two fewer than the par value for the hole.

    b. Write a code segment to display the hole numbers for all holes on which the golfer missed par. To miss par, the number of strokes on the hole must be greater than the par value for the hole.


    3. Write a code segment that prompts the user to enter a sentence and then displays all of the words in the sentence which have an odd number of letters in them. You may assume that the user will input a string consisting of only English language words each separated by exactly one blank space and that the only punctuation symbol will be a period at the end of the sentence.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Hw help!

    Do you have any specific questions about your assignment?
    Please post your code and any questions about problems you are having.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Hw help!

    Actually i dont know how to attempt it. I was able to do the first question but these last two werent covered in class so im really confused at the moment

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Hw help!

    Can you explain in English what the program for step 2 is supposed to do? Imagine you are trying to get a friend to manually do the steps needed to solve the problem. What would you tell him?
    For the arrays, use a table with two columns, one for the par and one for the strokes.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Hw help!

    Thats all that was given on the paper. I emailed my instructor but i didnt get a reply

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Hw help!

    What part(s) of part 2) don't you understand? Is it the scoring for the game of gulf?
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Hw help!

    Yes

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Hw help!

    Sorry, gulf scoring is not part of java. Part of it is explained in the assignment. Your instructor may have assumed too much for this one. Try asking a Search Engine about the scoring for gulf.
    If you don't understand my answer, don't ignore it, ask a question.