group_of__Solutions

# group_of__Solutions - We say this in the handout. But your...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 1. toString 05 out of 05 2. drawGreenTriangle 05 out of 05 3. drawGreenHex 10 out of 10 4. spiral or poly or radiate 20 out of 20 5. Ball constructor (5 par) 06 out of 10 6. Ball constructor (3 par) 05 out of 05 7. Ball: moveOnce 11 out of 15 8. Ball: perpetualMotion 09 out of 10 10. Recursive graphics 10 out of 20 Total 76 out of 100 Deduction: 5 points. You did not put comments on the fields in A5 for the radius and velocity of a ball. By now, you should know that field declarations have to be annotated with their meaning and any constraints on them Deduction: 4 points. In your constructors for balls, you draw the call using fillCircle(radius). However, The argument to fillCircle is supposed to be the diameter, not the radius. Some students draw not a filled circle but just the circumference. Here's a message to give them. Deduction: 4 points. In moveOnce, your test for going over a boundary is wrong in the following sense. You should test going over the top boundary only if the vertical speed is < 0.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: We say this in the handout. But your program does not deal with the direction of the speed. To see that your code does not work properly, try this ball and move it several times: b1= new A5 (20, -1, -1, java.awt.Color.green, -40, 0) Your loop will not work properly. Suppose you have an increment of k= k+1 Then at some point, this value will become negative (because int values wrap around), so the loop might actually stop at some point. Deduction: 5 points. You did not specify your two procedures properly. Deduction: 5 points. You did not write a public and a private procedure, as requested. Deduction: 1 point. The proper way to have a nonterminating loop is hwhile(true) { h }h. Deduction: 0. You donht pause after each line segment is drawn. We didnht require it, but it would have been nice. We canht tell what the parameters are for, we canht tell whether the public procedure clears the screen, etc. Sheet1 Page 2 ....
View Full Document

## This homework help was uploaded on 02/20/2009 for the course CS 100 taught by Professor Fan/vanloan during the Spring '07 term at Cornell University (Engineering School).

### Page1 / 2

group_of__Solutions - We say this in the handout. But your...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online