# Hw help!

• April 26th, 2013, 08:20 PM
BAA8081
Hw help!

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.
• April 26th, 2013, 08:34 PM
Norm
Re: Hw help!
• April 26th, 2013, 09:07 PM
BAA8081
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
• April 26th, 2013, 09:14 PM
Norm
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.
• April 26th, 2013, 09:46 PM
BAA8081
Re: Hw help!
Thats all that was given on the paper. I emailed my instructor but i didnt get a reply
• April 26th, 2013, 09:48 PM
Norm
Re: Hw help!
What part(s) of part 2) don't you understand? Is it the scoring for the game of gulf?
• April 26th, 2013, 10:26 PM
BAA8081
Re: Hw help!
Yes
• April 26th, 2013, 10:35 PM
Norm
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.