PS4: Fruitful Methods

Name:

TASK 1: PictureWorld Invocation Tree
The Invocation Tree diagram should have 2 parts: Object Land and Execution Land

1

 

Object Land should contain the correct number of objects: one SimplePictureWorld object and the appropriate number of Picture objects, each of which shows one of the distinct intermediate pictures created by the invocation tree.

5

 

Execution Land should contain an invocation tree with the correct number of nodes arranged in the correct tree structure. Each node should show (1) a reference to the receiver object (an instance of SimplePictureWorld), (2) the name of the invoked instance method, (3) references to the argument Picture objects and (4) a reference to the Picture object returned by the method invocation.

6

 

TOTAL FOR TASK 1

12

 

TASK 2: Knitting
Program compiles without errors 1  
Method definitions and invocations should be appropriate and meet the assignment specifications. For example, the the knit5() method should have exactly four Color parameters. The parameters should be used correctly throughout the methods, i.e., there should not be any fixed Color objects, such as Color.red, used in the knit5() method definition. None of the starter code should be modified, except that our comments may be deleted. 3  
Fruitful methods should be used correctly. The knit5() method should return a Picture object. Throughout the definition of knit5() and any auxiliary methods, Picture objects returned by fruitful methods should be used appropriately (e.g., they should not be thrown away). 2  
Pictures produced by the knit5() method should appear precisely as indicated in the assignment and the solution test code. 2  
Good programming style is observed:
- Code is concise and elegant
- Comments are used throughout the program to ensure readability and to explain appropriate aspects of the code.

2

 

TOTAL FOR TASK 2

10

 

TASK 3: Quilting
Program compiles without errors 1  
Method definitions and invocations should be appropriate and meet the assignment specifications. For example, the following methods must be defined as specified in the assignment: quilt1(), quilt2(), corner(), patch_2x2(), triangles_2x2(), LL(), and LLNest(). All these methods (and other helper methods) should be fruitful methods that return Picture objects. The quilt1() and quilt2() methods should not take any parameters, but it's a good idea to define a helper method for making quilts that takes six parameters. Note that the assignment does not specify requirements for quadrant1(), etc. Fixed colors, such as Color.red, should only be used in the body of the quilt1() and quilt2() methods, but not in any of the auxiliary methods (including quadrant1(), etc.) 8  
The Picture produced by the quilt1() method should appear precisely as indicated in the assignment and in the solution test code. 1  
The Picture produced by the quilt2() method should appear precisely as indicated in the assignment and in the solution test code. 1  
Good programming style is observed:
- Code is concise and elegant
- Helper methods are used to capture common patterns of computation. For example, the similarity between quilt1() and quilt2() should be captured by a helper method that takes six color parameters.
- Variables should be used to name Picture objects used more than once, to avoid recomputing these Picture objects.
- Comments are used throughout the program to ensure readability and to explain appropriate aspects of the code.

4

 

TOTAL FOR TASK 3

15

 

TASK 4: CS111 Grading Application
Program compiles without errors 1  
The program should contain a class (static) method named psetAverage that takes ten double parameters and calculates their average. 2  
The program should contain a class (static) method named courseScore that takes four double parameters and calculates their weighted average. 2  
The program should contain a class (static) method named letterGrade that returns the appropriate letter grade for a double in the range 0 to 100. 2  
The program should contain a class (static) method named printGrades that takes thirteen double parameters (ten pset scores and three exam scores, all in the range 0 to 100) and displays (1) the ten pset scores (2) the pset average (3) the three exam scores (4) the course score and (5) the letter grade. 3  
The program should be an application (i.e., contain a static method named main) that calls printGrades on any thirteen scores hardwired into the main method. 1  
Good program design. Methods should be used appropriately. Comments in the program enable readability. The code is concise and elegant. 2  
TOTAL FOR TASK 4

13

 

Total:       /50